Layout
This commit is contained in:
@@ -23,12 +23,16 @@ public partial class MainWindowViewModel : ViewModelBase
|
||||
|
||||
[ObservableProperty]
|
||||
private ObservableCollection<string> _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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,27 +14,25 @@
|
||||
to set the actual DataContext for runtime, set the DataContext property in code (look at App.axaml.cs) -->
|
||||
<viewModels:MainWindowViewModel />
|
||||
</Design.DataContext>
|
||||
<Panel>
|
||||
<StackPanel VerticalAlignment="Stretch" Margin="10">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Button Width="200" HorizontalContentAlignment="Center" Command="{Binding LoadSolutionFolderCommand}">Select Solution Folder</Button>
|
||||
<TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Background="Gray" Name="SolutionFolderPath" Text="{Binding SolutionFolderPath}" />
|
||||
<Button Width="60" HorizontalContentAlignment="Center" Command="{Binding ClearSolutionFolderCommand}">Clear</Button>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Button Width="200" HorizontalContentAlignment="Center" Command="{Binding LoadSolutionFileCommand}">Select Solution File</Button>
|
||||
<TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Name="SolutionFilePath" Text="{Binding SolutionFilePath}" />
|
||||
<Button Width="60" HorizontalContentAlignment="Center" Command="{Binding ClearSolutionFileCommand}">Clear</Button>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Button Width="200" HorizontalContentAlignment="Center" Command="{Binding LoadCsprojFileCommand}">Select CSharp Project File</Button>
|
||||
<TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Background="Gray" Name="CsprojFilePath" Text="{Binding CsprojFilePath}" />
|
||||
<Button Width="60" HorizontalContentAlignment="Center" Command="{Binding ClearCsprojFileCommand}">Clear</Button>
|
||||
|
||||
</StackPanel>
|
||||
<Separator Margin="0 10 0 0" />
|
||||
<Grid VerticalAlignment="Stretch" ShowGridLines="False" RowDefinitions="*,*" ColumnDefinitions="*,*,*">
|
||||
<Button Grid.Row="0" Grid.Column="0" MinHeight="130" Padding="10" Margin="10"
|
||||
<DockPanel Width="{Binding $parent.Bounds.Width}" Height="{Binding $parent.Bounds.Height}">
|
||||
<StackPanel Margin="5 10 5 5" Orientation="Vertical" DockPanel.Dock="Top">
|
||||
<Grid Margin="5 0 5 0" ColumnDefinitions="Auto,*,Auto">
|
||||
<Button Grid.Column="0" HorizontalContentAlignment="Center" Width="200" Command="{Binding LoadSolutionFolderCommand}">Select Solution Folder</Button>
|
||||
<TextBlock Grid.Column="1" VerticalAlignment="Center" TextAlignment="Center" Name="SolutionFolderPath2" Text="{Binding SolutionFolderPath}" />
|
||||
<Button Grid.Column="2" HorizontalContentAlignment="Center" Width="60" Command="{Binding ClearSolutionFolderCommand}">Clear</Button>
|
||||
</Grid>
|
||||
<Grid Margin="5 0 5 0" ColumnDefinitions="Auto,*,Auto">
|
||||
<Button Grid.Column="0" Width="200" HorizontalContentAlignment="Center" Command="{Binding LoadSolutionFileCommand}">Select Solution File</Button>
|
||||
<TextBlock Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Center" Name="SolutionFilePath" Text="{Binding SolutionFilePath}" />
|
||||
<Button Grid.Column="2" Width="60" HorizontalContentAlignment="Center" Command="{Binding ClearSolutionFileCommand}">Clear</Button>
|
||||
</Grid>
|
||||
<Grid Margin="5 0 5 0" ColumnDefinitions="Auto,*,Auto">
|
||||
<Button Grid.Column="0" Width="200" HorizontalContentAlignment="Center" Command="{Binding LoadCsprojFileCommand}">Select CSharp Project File</Button>
|
||||
<TextBlock Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Center" Name="CsprojFilePath" Text="{Binding CsprojFilePath}" />
|
||||
<Button Grid.Column="2" Width="60" HorizontalContentAlignment="Center" Command="{Binding ClearCsprojFileCommand}">Clear</Button>
|
||||
</Grid>
|
||||
<Grid Margin="0 5 0 0" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" ShowGridLines="False" RowDefinitions="*,*" ColumnDefinitions="*,*,*">
|
||||
<Button Grid.Row="0" Grid.Column="0" MinHeight="130" Padding="10" Margin="5"
|
||||
HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
|
||||
VerticalContentAlignment="Center" HorizontalContentAlignment="Center"
|
||||
IsEnabled="{Binding SolutionFolderPath, Mode=OneWay, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"
|
||||
@@ -43,7 +41,7 @@
|
||||
Check Solution Parity
|
||||
</TextBlock>
|
||||
</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"
|
||||
VerticalContentAlignment="Center" HorizontalContentAlignment="Center"
|
||||
IsEnabled="{Binding CsprojFilePath, Mode=OneWay, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"
|
||||
@@ -52,7 +50,7 @@
|
||||
Format CSharp Project File
|
||||
</TextBlock>
|
||||
</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"
|
||||
VerticalContentAlignment="Center" HorizontalContentAlignment="Center"
|
||||
IsEnabled="{Binding SolutionFilePath, Mode=OneWay, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"
|
||||
@@ -61,7 +59,7 @@
|
||||
Format All CSharp Project Files in Solution
|
||||
</TextBlock>
|
||||
</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"
|
||||
VerticalContentAlignment="Center" HorizontalContentAlignment="Center"
|
||||
IsEnabled="{Binding SolutionFolderPath, Mode=OneWay, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"
|
||||
@@ -69,9 +67,8 @@
|
||||
<TextBlock TextWrapping="Wrap">
|
||||
Format All CSharp Project Files in Folder
|
||||
</TextBlock>
|
||||
|
||||
</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"
|
||||
VerticalContentAlignment="Center" HorizontalContentAlignment="Center"
|
||||
IsEnabled="{Binding SolutionFilePath, Mode=OneWay, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"
|
||||
@@ -80,10 +77,20 @@
|
||||
Check For Missing Implicit Usings
|
||||
</TextBlock>
|
||||
</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>
|
||||
<ListBox Name="Results" ItemsSource="{Binding ParityResults}" />
|
||||
<ListBox ItemsSource="{Binding ErrorMessages}" />
|
||||
</StackPanel>
|
||||
</Panel>
|
||||
|
||||
<Label HorizontalAlignment="Center" Name="ResultsLabel" Content="{Binding ResultsLabel}"></Label>
|
||||
</StackPanel>
|
||||
<ScrollViewer Width="{Binding $parent.Bounds.Width}">
|
||||
<ListBox ScrollViewer.VerticalScrollBarVisibility="Visible" Name="Results" ItemsSource="{Binding ParityResults}" />
|
||||
</ScrollViewer>
|
||||
</DockPanel>
|
||||
</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
|
||||
.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);
|
||||
|
||||
Reference in New Issue
Block a user