mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-21 04:04:59 +00:00
fix: the way to deal with local changes did not update after radio toggle changed (#748)
This commit is contained in:
parent
1c0d8a2697
commit
1872148d98
6 changed files with 160 additions and 22 deletions
|
@ -1,4 +1,5 @@
|
|||
using Avalonia.Controls;
|
||||
using Avalonia.Interactivity;
|
||||
|
||||
namespace SourceGit.Views
|
||||
{
|
||||
|
@ -8,5 +9,51 @@ namespace SourceGit.Views
|
|||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
protected override void OnLoaded(RoutedEventArgs e)
|
||||
{
|
||||
base.OnLoaded(e);
|
||||
|
||||
var vm = DataContext as ViewModels.CreateBranch;
|
||||
if (vm == null)
|
||||
return;
|
||||
|
||||
switch (vm.PreAction)
|
||||
{
|
||||
case Models.DealWithLocalChanges.DoNothing:
|
||||
RadioDoNothing.IsChecked = true;
|
||||
break;
|
||||
case Models.DealWithLocalChanges.StashAndReaply:
|
||||
RadioStashAndReply.IsChecked = true;
|
||||
break;
|
||||
default:
|
||||
RadioDiscard.IsChecked = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnLocalChangeActionIsCheckedChanged(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var vm = DataContext as ViewModels.CreateBranch;
|
||||
if (vm == null)
|
||||
return;
|
||||
|
||||
if (RadioDoNothing.IsChecked == true)
|
||||
{
|
||||
if (vm.PreAction != Models.DealWithLocalChanges.DoNothing)
|
||||
vm.PreAction = Models.DealWithLocalChanges.DoNothing;
|
||||
return;
|
||||
}
|
||||
|
||||
if (RadioStashAndReply.IsChecked == true)
|
||||
{
|
||||
if (vm.PreAction != Models.DealWithLocalChanges.StashAndReaply)
|
||||
vm.PreAction = Models.DealWithLocalChanges.StashAndReaply;
|
||||
return;
|
||||
}
|
||||
|
||||
if (vm.PreAction != Models.DealWithLocalChanges.Discard)
|
||||
vm.PreAction = Models.DealWithLocalChanges.Discard;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue