Layout
This commit is contained in:
@@ -23,12 +23,16 @@ public partial class MainWindowViewModel : ViewModelBase
|
|||||||
|
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
private ObservableCollection<string> _parityResults = new() { };
|
private ObservableCollection<string> _parityResults = new() { };
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private string _resultsLabel = "Ready";
|
||||||
|
|
||||||
[RelayCommand]
|
[RelayCommand]
|
||||||
private async Task ExecuteParityChecker(CancellationToken token)
|
private async Task ExecuteParityChecker(CancellationToken token)
|
||||||
{
|
{
|
||||||
ParityResults.Clear();
|
ParityResults.Clear();
|
||||||
ErrorMessages?.Clear();
|
ErrorMessages?.Clear();
|
||||||
|
ResultsLabel = string.Empty;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var results = SolutionProjectParity.CompareSolutionAndCSharpProjects(
|
var results = SolutionProjectParity.CompareSolutionAndCSharpProjects(
|
||||||
@@ -37,10 +41,12 @@ public partial class MainWindowViewModel : ViewModelBase
|
|||||||
);
|
);
|
||||||
foreach (var result in results)
|
foreach (var result in results)
|
||||||
ParityResults.Add(result);
|
ParityResults.Add(result);
|
||||||
|
ResultsLabel = $"{results.Count} Projects in folder missing from solution";
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
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)
|
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)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
ErrorMessages?.Add(e.Message);
|
ResultsLabel = "Error";
|
||||||
|
ParityResults?.Add(e.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -95,14 +103,36 @@ public partial class MainWindowViewModel : ViewModelBase
|
|||||||
{
|
{
|
||||||
ErrorMessages?.Clear();
|
ErrorMessages?.Clear();
|
||||||
ParityResults.Clear();
|
ParityResults.Clear();
|
||||||
|
ResultsLabel = string.Empty;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var result = ImplicitUsings.FindCSharpProjectsMissingImplicitUsings(SolutionFilePath);
|
var results = ImplicitUsings.FindCSharpProjectsMissingImplicitUsings(SolutionFilePath);
|
||||||
result.ForEach(s => ParityResults.Add(s));
|
results.ForEach(s => ParityResults.Add(s));
|
||||||
|
ResultsLabel = $"{results.Count} Projects missing ImplicitUsings";
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
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)
|
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)
|
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)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
ErrorMessages?.Add(e.Message);
|
ResultsLabel = "Error";
|
||||||
|
ParityResults?.Add(e.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,27 +14,25 @@
|
|||||||
to set the actual DataContext for runtime, set the DataContext property in code (look at App.axaml.cs) -->
|
to set the actual DataContext for runtime, set the DataContext property in code (look at App.axaml.cs) -->
|
||||||
<viewModels:MainWindowViewModel />
|
<viewModels:MainWindowViewModel />
|
||||||
</Design.DataContext>
|
</Design.DataContext>
|
||||||
<Panel>
|
<DockPanel Width="{Binding $parent.Bounds.Width}" Height="{Binding $parent.Bounds.Height}">
|
||||||
<StackPanel VerticalAlignment="Stretch" Margin="10">
|
<StackPanel Margin="5 10 5 5" Orientation="Vertical" DockPanel.Dock="Top">
|
||||||
<StackPanel Orientation="Horizontal">
|
<Grid Margin="5 0 5 0" ColumnDefinitions="Auto,*,Auto">
|
||||||
<Button Width="200" HorizontalContentAlignment="Center" Command="{Binding LoadSolutionFolderCommand}">Select Solution Folder</Button>
|
<Button Grid.Column="0" HorizontalContentAlignment="Center" Width="200" Command="{Binding LoadSolutionFolderCommand}">Select Solution Folder</Button>
|
||||||
<TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Background="Gray" Name="SolutionFolderPath" Text="{Binding SolutionFolderPath}" />
|
<TextBlock Grid.Column="1" VerticalAlignment="Center" TextAlignment="Center" Name="SolutionFolderPath2" Text="{Binding SolutionFolderPath}" />
|
||||||
<Button Width="60" HorizontalContentAlignment="Center" Command="{Binding ClearSolutionFolderCommand}">Clear</Button>
|
<Button Grid.Column="2" HorizontalContentAlignment="Center" Width="60" Command="{Binding ClearSolutionFolderCommand}">Clear</Button>
|
||||||
</StackPanel>
|
</Grid>
|
||||||
<StackPanel Orientation="Horizontal">
|
<Grid Margin="5 0 5 0" ColumnDefinitions="Auto,*,Auto">
|
||||||
<Button Width="200" HorizontalContentAlignment="Center" Command="{Binding LoadSolutionFileCommand}">Select Solution File</Button>
|
<Button Grid.Column="0" Width="200" HorizontalContentAlignment="Center" Command="{Binding LoadSolutionFileCommand}">Select Solution File</Button>
|
||||||
<TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Name="SolutionFilePath" Text="{Binding SolutionFilePath}" />
|
<TextBlock Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Center" Name="SolutionFilePath" Text="{Binding SolutionFilePath}" />
|
||||||
<Button Width="60" HorizontalContentAlignment="Center" Command="{Binding ClearSolutionFileCommand}">Clear</Button>
|
<Button Grid.Column="2" Width="60" HorizontalContentAlignment="Center" Command="{Binding ClearSolutionFileCommand}">Clear</Button>
|
||||||
</StackPanel>
|
</Grid>
|
||||||
<StackPanel Orientation="Horizontal">
|
<Grid Margin="5 0 5 0" ColumnDefinitions="Auto,*,Auto">
|
||||||
<Button Width="200" HorizontalContentAlignment="Center" Command="{Binding LoadCsprojFileCommand}">Select CSharp Project File</Button>
|
<Button Grid.Column="0" Width="200" HorizontalContentAlignment="Center" Command="{Binding LoadCsprojFileCommand}">Select CSharp Project File</Button>
|
||||||
<TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Background="Gray" Name="CsprojFilePath" Text="{Binding CsprojFilePath}" />
|
<TextBlock Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Center" Name="CsprojFilePath" Text="{Binding CsprojFilePath}" />
|
||||||
<Button Width="60" HorizontalContentAlignment="Center" Command="{Binding ClearCsprojFileCommand}">Clear</Button>
|
<Button Grid.Column="2" Width="60" HorizontalContentAlignment="Center" Command="{Binding ClearCsprojFileCommand}">Clear</Button>
|
||||||
|
</Grid>
|
||||||
</StackPanel>
|
<Grid Margin="0 5 0 0" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" ShowGridLines="False" RowDefinitions="*,*" ColumnDefinitions="*,*,*">
|
||||||
<Separator Margin="0 10 0 0" />
|
<Button Grid.Row="0" Grid.Column="0" MinHeight="130" Padding="10" Margin="5"
|
||||||
<Grid VerticalAlignment="Stretch" ShowGridLines="False" RowDefinitions="*,*" ColumnDefinitions="*,*,*">
|
|
||||||
<Button Grid.Row="0" Grid.Column="0" MinHeight="130" Padding="10" Margin="10"
|
|
||||||
HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
|
HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
|
||||||
VerticalContentAlignment="Center" HorizontalContentAlignment="Center"
|
VerticalContentAlignment="Center" HorizontalContentAlignment="Center"
|
||||||
IsEnabled="{Binding SolutionFolderPath, Mode=OneWay, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"
|
IsEnabled="{Binding SolutionFolderPath, Mode=OneWay, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"
|
||||||
@@ -43,7 +41,7 @@
|
|||||||
Check Solution Parity
|
Check Solution Parity
|
||||||
</TextBlock>
|
</TextBlock>
|
||||||
</Button>
|
</Button>
|
||||||
<Button Grid.Row="0" Grid.Column="1" MinHeight="130" Padding="10" Margin="10"
|
<Button Grid.Row="0" Grid.Column="1" MinHeight="130" Padding="10" Margin="5"
|
||||||
HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
|
HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
|
||||||
VerticalContentAlignment="Center" HorizontalContentAlignment="Center"
|
VerticalContentAlignment="Center" HorizontalContentAlignment="Center"
|
||||||
IsEnabled="{Binding CsprojFilePath, Mode=OneWay, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"
|
IsEnabled="{Binding CsprojFilePath, Mode=OneWay, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"
|
||||||
@@ -52,7 +50,7 @@
|
|||||||
Format CSharp Project File
|
Format CSharp Project File
|
||||||
</TextBlock>
|
</TextBlock>
|
||||||
</Button>
|
</Button>
|
||||||
<Button Grid.Row="0" Grid.Column="2" MinHeight="130" Padding="10" Margin="10"
|
<Button Grid.Row="0" Grid.Column="2" MinHeight="130" Padding="10" Margin="5"
|
||||||
HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
|
HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
|
||||||
VerticalContentAlignment="Center" HorizontalContentAlignment="Center"
|
VerticalContentAlignment="Center" HorizontalContentAlignment="Center"
|
||||||
IsEnabled="{Binding SolutionFilePath, Mode=OneWay, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"
|
IsEnabled="{Binding SolutionFilePath, Mode=OneWay, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"
|
||||||
@@ -61,7 +59,7 @@
|
|||||||
Format All CSharp Project Files in Solution
|
Format All CSharp Project Files in Solution
|
||||||
</TextBlock>
|
</TextBlock>
|
||||||
</Button>
|
</Button>
|
||||||
<Button Grid.Row="1" Grid.Column="0" MinHeight="130" Padding="10" Margin="10"
|
<Button Grid.Row="1" Grid.Column="0" MinHeight="130" Padding="10" Margin="5"
|
||||||
HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
|
HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
|
||||||
VerticalContentAlignment="Center" HorizontalContentAlignment="Center"
|
VerticalContentAlignment="Center" HorizontalContentAlignment="Center"
|
||||||
IsEnabled="{Binding SolutionFolderPath, Mode=OneWay, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"
|
IsEnabled="{Binding SolutionFolderPath, Mode=OneWay, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"
|
||||||
@@ -69,9 +67,8 @@
|
|||||||
<TextBlock TextWrapping="Wrap">
|
<TextBlock TextWrapping="Wrap">
|
||||||
Format All CSharp Project Files in Folder
|
Format All CSharp Project Files in Folder
|
||||||
</TextBlock>
|
</TextBlock>
|
||||||
|
|
||||||
</Button>
|
</Button>
|
||||||
<Button Grid.Row="1" Grid.Column="1" MinHeight="130" Padding="10" Margin="10"
|
<Button Grid.Row="1" Grid.Column="1" MinHeight="130" Padding="10" Margin="5"
|
||||||
HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
|
HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
|
||||||
VerticalContentAlignment="Center" HorizontalContentAlignment="Center"
|
VerticalContentAlignment="Center" HorizontalContentAlignment="Center"
|
||||||
IsEnabled="{Binding SolutionFilePath, Mode=OneWay, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"
|
IsEnabled="{Binding SolutionFilePath, Mode=OneWay, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"
|
||||||
@@ -80,10 +77,20 @@
|
|||||||
Check For Missing Implicit Usings
|
Check For Missing Implicit Usings
|
||||||
</TextBlock>
|
</TextBlock>
|
||||||
</Button>
|
</Button>
|
||||||
|
<Button Grid.Row="1" Grid.Column="2" MinHeight="130" Padding="10" Margin="5"
|
||||||
|
HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
|
||||||
|
VerticalContentAlignment="Center" HorizontalContentAlignment="Center"
|
||||||
|
IsEnabled="{Binding SolutionFilePath, Mode=OneWay, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"
|
||||||
|
Command="{Binding CheckForMissingTreatWarningsAsErrorsInSolutionFileCommand}">
|
||||||
|
<TextBlock TextWrapping="Wrap">
|
||||||
|
Check For Missing Treat Warnings as Errors
|
||||||
|
</TextBlock>
|
||||||
|
</Button>
|
||||||
</Grid>
|
</Grid>
|
||||||
<ListBox Name="Results" ItemsSource="{Binding ParityResults}" />
|
<Label HorizontalAlignment="Center" Name="ResultsLabel" Content="{Binding ResultsLabel}"></Label>
|
||||||
<ListBox ItemsSource="{Binding ErrorMessages}" />
|
</StackPanel>
|
||||||
</StackPanel>
|
<ScrollViewer Width="{Binding $parent.Bounds.Width}">
|
||||||
</Panel>
|
<ListBox ScrollViewer.VerticalScrollBarVisibility="Visible" Name="Results" ItemsSource="{Binding ParityResults}" />
|
||||||
|
</ScrollViewer>
|
||||||
|
</DockPanel>
|
||||||
</Window>
|
</Window>
|
||||||
@@ -54,7 +54,7 @@ public static class WarningsAsErrors
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool ProjectIsMissingTreatWarningsAsErrors(ProjectRootElement project)
|
private static bool ProjectIsMissingTreatWarningsAsErrors(ProjectRootElement project)
|
||||||
{
|
{
|
||||||
var implicitUsings = project.PropertyGroups
|
var implicitUsings = project.PropertyGroups
|
||||||
.SelectMany(x => x.Properties)
|
.SelectMany(x => x.Properties)
|
||||||
@@ -67,7 +67,7 @@ public static class WarningsAsErrors
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool ProjectBuildSuccessfully(ProjectRootElement project)
|
private static bool ProjectBuildSuccessfully(ProjectRootElement project)
|
||||||
{
|
{
|
||||||
// build the project
|
// build the project
|
||||||
var buildProject = new Microsoft.Build.Evaluation.Project(project);
|
var buildProject = new Microsoft.Build.Evaluation.Project(project);
|
||||||
|
|||||||
Reference in New Issue
Block a user