diff --git a/DotNetSolutionTools.App/ViewModels/MainWindowViewModel.cs b/DotNetSolutionTools.App/ViewModels/MainWindowViewModel.cs index be799ac..104be19 100644 --- a/DotNetSolutionTools.App/ViewModels/MainWindowViewModel.cs +++ b/DotNetSolutionTools.App/ViewModels/MainWindowViewModel.cs @@ -23,12 +23,16 @@ public partial class MainWindowViewModel : ViewModelBase [ObservableProperty] private ObservableCollection _parityResults = new() { }; + + [ObservableProperty] + private string _resultsLabel = "Ready"; [RelayCommand] private async Task ExecuteParityChecker(CancellationToken token) { ParityResults.Clear(); ErrorMessages?.Clear(); + ResultsLabel = string.Empty; try { var results = SolutionProjectParity.CompareSolutionAndCSharpProjects( @@ -37,10 +41,12 @@ public partial class MainWindowViewModel : ViewModelBase ); foreach (var result in results) ParityResults.Add(result); + ResultsLabel = $"{results.Count} Projects in folder missing from solution"; } catch (Exception e) { - ErrorMessages?.Add(e.Message); + ResultsLabel = "Error"; + ParityResults?.Add(e.Message); } } @@ -66,7 +72,8 @@ public partial class MainWindowViewModel : ViewModelBase } catch (Exception e) { - ErrorMessages?.Add(e.Message); + ResultsLabel = "Error"; + ParityResults?.Add(e.Message); } } @@ -86,7 +93,8 @@ public partial class MainWindowViewModel : ViewModelBase } catch (Exception e) { - ErrorMessages?.Add(e.Message); + ResultsLabel = "Error"; + ParityResults?.Add(e.Message); } } @@ -95,14 +103,36 @@ public partial class MainWindowViewModel : ViewModelBase { ErrorMessages?.Clear(); ParityResults.Clear(); + ResultsLabel = string.Empty; try { - var result = ImplicitUsings.FindCSharpProjectsMissingImplicitUsings(SolutionFilePath); - result.ForEach(s => ParityResults.Add(s)); + var results = ImplicitUsings.FindCSharpProjectsMissingImplicitUsings(SolutionFilePath); + results.ForEach(s => ParityResults.Add(s)); + ResultsLabel = $"{results.Count} Projects missing ImplicitUsings"; } catch (Exception e) { - ErrorMessages?.Add(e.Message); + ResultsLabel = "Error"; + ParityResults?.Add(e.Message); + } + } + + [RelayCommand] + private async Task CheckForMissingTreatWarningsAsErrorsInSolutionFile(CancellationToken token) + { + ErrorMessages?.Clear(); + ParityResults.Clear(); + ResultsLabel = string.Empty; + try + { + var results = WarningsAsErrors.FindCSharpProjectsMissingTreatWarningsAsErrors(SolutionFilePath); + results.ForEach(s => ParityResults.Add(s)); + ResultsLabel = $"{results.Count} Projects missing TreatWarningsAsErrors"; + } + catch (Exception e) + { + ResultsLabel = "Error"; + ParityResults?.Add(e.Message); } } @@ -121,7 +151,8 @@ public partial class MainWindowViewModel : ViewModelBase } catch (Exception e) { - ErrorMessages?.Add(e.Message); + ResultsLabel = "Error"; + ParityResults?.Add(e.Message); } } @@ -147,7 +178,8 @@ public partial class MainWindowViewModel : ViewModelBase } catch (Exception e) { - ErrorMessages?.Add(e.Message); + ResultsLabel = "Error"; + ParityResults?.Add(e.Message); } } @@ -173,7 +205,8 @@ public partial class MainWindowViewModel : ViewModelBase } catch (Exception e) { - ErrorMessages?.Add(e.Message); + ResultsLabel = "Error"; + ParityResults?.Add(e.Message); } } diff --git a/DotNetSolutionTools.App/Views/MainWindow.axaml b/DotNetSolutionTools.App/Views/MainWindow.axaml index a1d108b..0ed141c 100644 --- a/DotNetSolutionTools.App/Views/MainWindow.axaml +++ b/DotNetSolutionTools.App/Views/MainWindow.axaml @@ -14,27 +14,25 @@ to set the actual DataContext for runtime, set the DataContext property in code (look at App.axaml.cs) --> - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - - - + - - - - - + + + + + + \ No newline at end of file diff --git a/DotNetSolutionTools.Core/WarningsAsErrors.cs b/DotNetSolutionTools.Core/WarningsAsErrors.cs index 414e96e..6435703 100644 --- a/DotNetSolutionTools.Core/WarningsAsErrors.cs +++ b/DotNetSolutionTools.Core/WarningsAsErrors.cs @@ -54,7 +54,7 @@ public static class WarningsAsErrors } } - public static bool ProjectIsMissingTreatWarningsAsErrors(ProjectRootElement project) + private static bool ProjectIsMissingTreatWarningsAsErrors(ProjectRootElement project) { var implicitUsings = project.PropertyGroups .SelectMany(x => x.Properties) @@ -67,7 +67,7 @@ public static class WarningsAsErrors return false; } - public static bool ProjectBuildSuccessfully(ProjectRootElement project) + private static bool ProjectBuildSuccessfully(ProjectRootElement project) { // build the project var buildProject = new Microsoft.Build.Evaluation.Project(project);