8
8
using DotNetSolutionTools . App . Services ;
9
9
using DotNetSolutionTools . Core ;
10
10
using DotNetSolutionTools . Core . Common ;
11
+ using NuGet . Packaging ;
11
12
12
13
namespace DotNetSolutionTools . App . ViewModels ;
13
14
@@ -45,10 +46,12 @@ private void SetBeginCommandState()
45
46
ResultsLabelColor = new ImmutableSolidColorBrush ( Colors . Black ) ;
46
47
}
47
48
48
- private void SetCommandSuccessState ( string message )
49
+ private void SetCommandSuccessState ( string message , IEnumerable < string > ? results = null )
49
50
{
50
51
ResultsLabel = message ;
51
52
ResultsLabelColor = new ImmutableSolidColorBrush ( Colors . Green ) ;
53
+ if ( results is not null )
54
+ OperationResults . AddRange ( results ) ;
52
55
}
53
56
54
57
private void SetCommandFailureState ( string message , Exception e )
@@ -72,9 +75,7 @@ await Task.Run(
72
75
SolutionFolderPath ,
73
76
SolutionFilePath
74
77
) ;
75
- foreach ( var result in results )
76
- OperationResults . Add ( result ) ;
77
- SetCommandSuccessState ( $ "{ results . Count } Projects in folder missing from solution") ;
78
+ SetCommandSuccessState ( $ "{ results . Count } Projects in folder missing from solution", results ) ;
78
79
} ,
79
80
token
80
81
) ;
@@ -167,8 +168,7 @@ await Task.Run(
167
168
( ) =>
168
169
{
169
170
var results = ImplicitUsings . FindCSharpProjectsMissingImplicitUsings ( SolutionFilePath ) ;
170
- results . ForEach ( s => OperationResults . Add ( s ) ) ;
171
- SetCommandSuccessState ( $ "{ results . Count } Projects missing ImplicitUsings") ;
171
+ SetCommandSuccessState ( $ "{ results . Count } Projects missing ImplicitUsings", results ) ;
172
172
} ,
173
173
token
174
174
) ;
@@ -189,8 +189,7 @@ await Task.Run(
189
189
( ) =>
190
190
{
191
191
var results = WarningsAsErrors . FindCSharpProjectsMissingTreatWarningsAsErrors ( SolutionFilePath ) ;
192
- results . ForEach ( s => OperationResults . Add ( s ) ) ;
193
- SetCommandSuccessState ( $ "{ results . Count } Projects missing TreatWarningsAsErrors") ;
192
+ SetCommandSuccessState ( $ "{ results . Count } Projects missing TreatWarningsAsErrors", results ) ;
194
193
} ,
195
194
token
196
195
) ;
0 commit comments