33using System . ComponentModel . Composition ;
44using System . Linq ;
55using System . Threading ;
6- using System . Windows ;
76using FineCodeCoverage . Core . Utilities ;
87using FineCodeCoverage . Engine . Cobertura ;
98using FineCodeCoverage . Engine . Model ;
@@ -25,33 +24,10 @@ internal class FCCEngine : IFCCEngine
2524 private CancellationTokenSource cancellationTokenSource ;
2625
2726 public event UpdateMarginTagsDelegate UpdateMarginTags ;
28- public event UpdateOutputWindowDelegate UpdateOutputWindow ;
2927
3028 public string AppDataFolderPath { get ; private set ; }
3129 public List < CoverageLine > CoverageLines { get ; internal set ; }
3230
33- private DpiScale dpiScale ;
34- public DpiScale Dpi
35- {
36- get => dpiScale ;
37- set
38- {
39- reportGeneratorUtil . DpiScale = value ;
40- dpiScale = value ;
41- UpdateReportWithDpiFontChanges ( ) ;
42-
43- }
44- }
45- private FontDetails environmentFontDetails ;
46- public FontDetails EnvironmentFontDetails {
47- get => environmentFontDetails ;
48- set {
49- environmentFontDetails = value ;
50- reportGeneratorUtil . EnvironmentFontDetails = value ;
51- UpdateReportWithDpiFontChanges ( ) ;
52- }
53- }
54-
5531 private readonly ICoverageUtilManager coverageUtilManager ;
5632 private readonly ICoberturaUtil coberturaUtil ;
5733 private readonly IMsTestPlatformUtil msTestPlatformUtil ;
@@ -64,7 +40,7 @@ public FontDetails EnvironmentFontDetails {
6440 private readonly ICoverageToolOutputManager coverageOutputManager ;
6541 internal System . Threading . Tasks . Task reloadCoverageTask ;
6642 private ISolutionEvents solutionEvents ; // keep alive
67- private bool hasGeneratedReport ;
43+ private readonly IEventAggregator eventAggregator ;
6844
6945 [ ImportingConstructor ]
7046 public FCCEngine (
@@ -77,10 +53,12 @@ public FCCEngine(
7753 IAppDataFolder appDataFolder ,
7854 ICoverageToolOutputManager coverageOutputManager ,
7955 ISolutionEvents solutionEvents ,
80- IAppOptionsProvider appOptionsProvider
56+ IAppOptionsProvider appOptionsProvider ,
57+ IEventAggregator eventAggregator
8158 )
8259 {
8360 this . solutionEvents = solutionEvents ;
61+ this . eventAggregator = eventAggregator ;
8462 solutionEvents . AfterClosing += ( s , args ) => ClearOutputWindow ( false ) ;
8563 appOptionsProvider . OptionsChanged += ( appOptions ) =>
8664 {
@@ -132,14 +110,6 @@ private void ClearOutputWindow(bool withHistory)
132110 RaiseUpdateOutputWindow ( reportGeneratorUtil . BlankReport ( withHistory ) ) ;
133111 }
134112
135- private void UpdateReportWithDpiFontChanges ( )
136- {
137- if ( hasGeneratedReport )
138- {
139- reportGeneratorUtil . UpdateReportWithDpiFontChanges ( ) ;
140- }
141- }
142-
143113 public void StopCoverage ( )
144114 {
145115 if ( cancellationTokenSource != null )
@@ -209,9 +179,7 @@ await coverageProject.StepAsync("Run Coverage Tool", async (project) =>
209179
210180 private void RaiseUpdateOutputWindow ( string reportHtml )
211181 {
212- UpdateOutputWindowEventArgs updateOutputWindowEventArgs = new UpdateOutputWindowEventArgs { HtmlContent = reportHtml } ;
213- UpdateOutputWindow ? . Invoke ( updateOutputWindowEventArgs ) ;
214- hasGeneratedReport = true ;
182+ eventAggregator . SendMessage ( new NewReportMessage { Report = reportHtml } ) ;
215183 }
216184
217185 private void UpdateUI ( List < CoverageLine > coverageLines , string reportHtml )
@@ -362,11 +330,6 @@ public void ReloadCoverage(Func<System.Threading.Tasks.Task<List<ICoverageProjec
362330 } , System . Threading . Tasks . TaskScheduler . Default ) ;
363331
364332 }
365-
366- public void ReadyForReport ( )
367- {
368- ClearOutputWindow ( false ) ;
369- }
370333 }
371334
372335}
0 commit comments