refactor: rewrite stash local changes

Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
leo 2025-06-17 20:56:02 +08:00
parent 10569022d7
commit 957fbbf54f
No known key found for this signature in database
16 changed files with 92 additions and 77 deletions

View file

@ -2,6 +2,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:m="using:SourceGit.Models"
xmlns:vm="using:SourceGit.ViewModels"
xmlns:v="using:SourceGit.Views"
mc:Ignorable="d" d:DesignWidth="500" d:DesignHeight="450"
@ -11,7 +12,7 @@
<TextBlock FontSize="18"
Classes="bold"
Text="{DynamicResource Text.Stash.Title}"/>
<Grid Margin="8,16,0,0" RowDefinitions="32,Auto,Auto,32,Auto,Auto" ColumnDefinitions="120,*">
<Grid Margin="8,16,0,0" RowDefinitions="32,32,Auto,Auto,Auto" ColumnDefinitions="120,*">
<TextBlock Grid.Row="0" Grid.Column="0"
HorizontalAlignment="Right"
Margin="8,0"
@ -23,12 +24,30 @@
Watermark="{DynamicResource Text.Stash.Message.Placeholder}"
v:AutoFocusBehaviour.IsEnabled="True"/>
<CheckBox Grid.Row="1" Grid.Column="1"
Height="32"
Content="{DynamicResource Text.Stash.IncludeUntracked}"
IsChecked="{Binding IncludeUntracked, Mode=TwoWay}"
IsVisible="{Binding !HasSelectedFiles}"
ToolTip.Tip="--include-untracked"/>
<TextBlock Grid.Row="1" Grid.Column="0"
HorizontalAlignment="Right"
Margin="8,0"
Text="{DynamicResource Text.Stash.Changes}"/>
<ComboBox Grid.Row="1" Grid.Column="1"
MinHeight="28"
Padding="8,0"
ItemsSource="{Binding Source={x:Static m:DealWithChangesAfterStashing.Supported}}"
SelectedIndex="{Binding ChangesAfterStashing, Mode=TwoWay}"
HorizontalAlignment="Stretch">
<ComboBox.ItemTemplate>
<DataTemplate DataType="m:DealWithChangesAfterStashing">
<Grid Height="20">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="{Binding Label}"/>
<TextBlock Grid.Column="1" Text="{Binding Desc}" Margin="8,0" FontSize="11" Foreground="{DynamicResource Brush.FG2}"/>
</Grid>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<CheckBox Grid.Row="2" Grid.Column="1"
Height="32"
@ -39,17 +58,18 @@
<CheckBox Grid.Row="3" Grid.Column="1"
Height="32"
Content="{DynamicResource Text.Stash.KeepIndex}"
IsChecked="{Binding KeepIndex, Mode=TwoWay}"
ToolTip.Tip="--keep-index"/>
Content="{DynamicResource Text.Stash.IncludeUntracked}"
IsChecked="{Binding IncludeUntracked, Mode=TwoWay}"
ToolTip.Tip="--include-untracked">
<CheckBox.IsVisible>
<MultiBinding Converter="{x:Static BoolConverters.And}">
<Binding Path="HasSelectedFiles" Converter="{x:Static BoolConverters.Not}"/>
<Binding Path="OnlyStaged" Converter="{x:Static BoolConverters.Not}"/>
</MultiBinding>
</CheckBox.IsVisible>
</CheckBox>
<CheckBox Grid.Row="4" Grid.Column="1"
Height="32"
Content="{DynamicResource Text.Stash.AutoRestore}"
IsChecked="{Binding AutoRestore, Mode=TwoWay}"
ToolTip.Tip="{DynamicResource Text.Stash.AutoRestore.Tip}"/>
<TextBlock Grid.Row="5" Grid.Column="1"
<TextBlock Grid.Row="4" Grid.Column="1"
Margin="0,4,0,0"
Text="{DynamicResource Text.Stash.TipForSelectedFiles}"
TextWrapping="Wrap"