code_review: PR #98

* remove the `Leave` option (it may lead to an undefined behaviour), so user can only choose `Stash & reapply` or `Discard`.
* re-design the UI
* remove unused resources
This commit is contained in:
leo 2024-04-29 17:22:22 +08:00
parent 927a1cab24
commit 776605cb68
7 changed files with 75 additions and 89 deletions

View file

@ -10,22 +10,29 @@
<TextBlock FontSize="18"
Classes="bold"
Text="{DynamicResource Text.Checkout}"/>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="0,16,0,0">
<TextBlock Text="{DynamicResource Text.Checkout.Target}"/>
<Path Width="14" Height="14" Margin="8,0" Data="{StaticResource Icons.Branch}"/>
<TextBlock Text="{Binding Branch}"/>
</StackPanel>
<StackPanel Orientation="Vertical" IsVisible="{Binding HasLocalChanges}">
<TextBlock Text="{DynamicResource Text.Checkout.LocalChanges}"/>
<RadioButton Content="{DynamicResource Text.Checkout.LocalChanges.StashAndReply}"
GroupName="LocalChanges"
IsChecked="{Binding StashLocalChanges, Mode=TwoWay }"/>
<RadioButton Content="{DynamicResource Text.Checkout.LocalChanges.Discard}"
GroupName="LocalChanges"
IsChecked="{Binding DiscardLocalChanges, Mode=TwoWay}"/>
<RadioButton Content="{DynamicResource Text.Checkout.LocalChanges.Leave}"
GroupName="LocalChanges"
IsChecked="{Binding LeaveLocalChanges, Mode=TwoWay}"/>
</StackPanel>
<Grid Margin="0,16,0,0" RowDefinitions="32,32" ColumnDefinitions="150,*">
<TextBlock Grid.Row="0" Grid.Column="0"
HorizontalAlignment="Right" VerticalAlignment="Center"
Margin="0,0,8,0"
Text="{DynamicResource Text.Checkout.Target}"/>
<StackPanel Grid.Row="0" Grid.Column="1" Orientation="Horizontal">
<Path Width="14" Height="14" Margin="8,0" Data="{StaticResource Icons.Branch}"/>
<TextBlock Text="{Binding Branch}"/>
</StackPanel>
<TextBlock Grid.Row="1" Grid.Column="0"
HorizontalAlignment="Right" VerticalAlignment="Center"
Margin="0,0,8,0"
Text="{DynamicResource Text.Checkout.LocalChanges}"/>
<StackPanel Grid.Row="1" Grid.Column="1" Orientation="Horizontal">
<RadioButton Content="{DynamicResource Text.Checkout.LocalChanges.StashAndReply}"
GroupName="LocalChanges"
IsChecked="{Binding AutoStash, Mode=TwoWay}"/>
<RadioButton Content="{DynamicResource Text.Checkout.LocalChanges.Discard}"
GroupName="LocalChanges"
Margin="8,0,0,0"/>
</StackPanel>
</Grid>
</StackPanel>
</UserControl>

View file

@ -298,7 +298,7 @@ namespace SourceGit.Views
if (branch.IsCurrent)
return;
ViewModels.Checkout.ShowPopup(repo, branch.Name);
repo.CheckoutLocalBranch(branch.Name);
e.Handled = true;
}
}