2024-02-05 23:08:37 -08:00
|
|
|
using Avalonia.Controls;
|
2024-11-27 02:31:50 -08:00
|
|
|
using Avalonia.Interactivity;
|
2024-02-05 23:08:37 -08:00
|
|
|
|
2024-03-17 18:37:06 -07:00
|
|
|
namespace SourceGit.Views
|
|
|
|
{
|
|
|
|
public partial class CreateBranch : UserControl
|
|
|
|
{
|
|
|
|
public CreateBranch()
|
|
|
|
{
|
2024-02-05 23:08:37 -08:00
|
|
|
InitializeComponent();
|
|
|
|
}
|
2024-11-27 02:31:50 -08:00
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
2024-02-05 23:08:37 -08:00
|
|
|
}
|
2024-03-31 01:54:29 -07:00
|
|
|
}
|