Enabled data grid editing
This commit is contained in:
Родитель
723f037493
Коммит
dc155c297d
|
@ -4,16 +4,41 @@
|
|||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d"
|
||||
Title="MainWindow" Height="600" Width="800"
|
||||
Title="MainWindow" Height="700" Width="1000"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
UseLayoutRounding="True" SnapsToDevicePixels="True" TextOptions.TextFormattingMode="Display">
|
||||
<Grid>
|
||||
<DataGrid ItemsSource="{Binding GroupedReferences}">
|
||||
<DataGrid.RowDetailsTemplate>
|
||||
<DataTemplate>
|
||||
<DataGrid ItemsSource="{Binding}"/>
|
||||
</DataTemplate>
|
||||
</DataGrid.RowDetailsTemplate>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="250"/>
|
||||
<ColumnDefinition Width="10"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="3">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<TextBox x:Name="textSearchPath" Text="C:\DOWNLOADS\GitHub\" Grid.Row="0"/>
|
||||
<TextBox x:Name="textSearchPattern" Text="*.props" Grid.Row="1"/>
|
||||
<Button x:Name="buttonSearch" Content="_Search" Click="buttonSearch_Click" Grid.Row="2"/>
|
||||
</Grid>
|
||||
<DataGrid x:Name="groups" ItemsSource="{Binding GroupedReferences}" CanUserAddRows="False" AutoGenerateColumns="False" Grid.Row="1" Grid.Column="0">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Header="Key" Binding="{Binding Key}" IsReadOnly="True"/>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
<GridSplitter ResizeDirection="Columns" ResizeBehavior="PreviousAndNext" Width="10" Grid.Row="1" Grid.Column="1"/>
|
||||
<DataGrid x:Name="references" ItemsSource="{Binding ElementName=groups, Path=SelectedItem.Value}" CanUserAddRows="False" AutoGenerateColumns="False" Grid.Row="1" Grid.Column="2">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Header="Name" Binding="{Binding Name}" IsReadOnly="True"/>
|
||||
<DataGridTextColumn Header="Version" Binding="{Binding Version}" IsReadOnly="False"/>
|
||||
<DataGridTextColumn Header="FileName" Binding="{Binding FileName}" IsReadOnly="True"/>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</Grid>
|
||||
</Window>
|
||||
|
|
|
@ -7,14 +7,14 @@ namespace MSBuildPropsUpdater
|
|||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
var updater = Updater.Create(@"C:\DOWNLOADS\GitHub\", "*.props", new string[] { });
|
||||
|
||||
updater.PrintVersions();
|
||||
|
||||
updater.ValidateVersions();
|
||||
|
||||
DataContext = updater;
|
||||
private void buttonSearch_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
//var updater = Updater.Create(@"C:\DOWNLOADS\GitHub\", "*.props", new string[] { });
|
||||
//updater.PrintVersions();
|
||||
//updater.ValidateVersions();
|
||||
DataContext = Updater.Create(textSearchPath.Text, textSearchPattern.Text, new string[] { });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,9 +9,9 @@ namespace MSBuildPropsUpdater
|
|||
{
|
||||
public class Updater
|
||||
{
|
||||
public IList<XDocument> Documents { get; private set; }
|
||||
public IList<PackageReference> References { get; private set; }
|
||||
public IEnumerable<IGrouping<string, PackageReference>> GroupedReferences { get; private set; }
|
||||
public IList<XDocument> Documents { get; set; }
|
||||
public IList<PackageReference> References { get; set; }
|
||||
public Dictionary<string, List<PackageReference>> GroupedReferences { get; set; }
|
||||
|
||||
public static string NormalizePath(string path)
|
||||
{
|
||||
|
@ -57,7 +57,7 @@ namespace MSBuildPropsUpdater
|
|||
|
||||
FindReferences(searchPath, searchPattern, ignoredPaths, updater.References, updater.Documents);
|
||||
|
||||
updater.GroupedReferences = updater.References.GroupBy(x => x.Name);
|
||||
updater.GroupedReferences = updater.References.GroupBy(x => x.Name).OrderBy(x => x.Key).ToDictionary(x => x.Key, x => x.ToList());
|
||||
|
||||
return updater;
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ namespace MSBuildPropsUpdater
|
|||
foreach (var package in GroupedReferences)
|
||||
{
|
||||
Debug.WriteLine($"Package {package.Key} is installed:");
|
||||
foreach (var v in package)
|
||||
foreach (var v in package.Value)
|
||||
{
|
||||
Debug.WriteLine($"{v.Version}, {v.FileName}");
|
||||
}
|
||||
|
@ -80,12 +80,12 @@ namespace MSBuildPropsUpdater
|
|||
Debug.WriteLine("Checking installed NuGet package dependencies versions:");
|
||||
foreach (var package in GroupedReferences)
|
||||
{
|
||||
var packageVersion = package.First().Version;
|
||||
bool isValidVersion = package.All(x => x.Version == packageVersion);
|
||||
var packageVersion = package.Value.First().Version;
|
||||
bool isValidVersion = package.Value.All(x => x.Version == packageVersion);
|
||||
if (!isValidVersion)
|
||||
{
|
||||
Debug.WriteLine($"Error: package {package.Key} has multiple versions installed:");
|
||||
foreach (var v in package)
|
||||
foreach (var v in package.Value)
|
||||
{
|
||||
Debug.WriteLine($"{v.Version}, {v.FileName}");
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче