mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-25 21:07:20 -08: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
|
@ -32,22 +32,21 @@
|
||||||
HorizontalAlignment="Right" VerticalAlignment="Center"
|
HorizontalAlignment="Right" VerticalAlignment="Center"
|
||||||
Margin="0,0,8,0"
|
Margin="0,0,8,0"
|
||||||
Text="{DynamicResource Text.Checkout.LocalChanges}"/>
|
Text="{DynamicResource Text.Checkout.LocalChanges}"/>
|
||||||
<WrapPanel Grid.Row="1" Grid.Column="1" Orientation="Horizontal" VerticalAlignment="Center">
|
<WrapPanel Grid.Row="1" Grid.Column="1" Orientation="Horizontal" VerticalAlignment="Center">
|
||||||
<WrapPanel.Resources>
|
|
||||||
<ac:EnumToBoolConverter x:Key="EnumToBoolConverter"/>
|
|
||||||
</WrapPanel.Resources>
|
|
||||||
|
|
||||||
<RadioButton Content="{DynamicResource Text.CreateBranch.LocalChanges.DoNothing}"
|
<RadioButton Content="{DynamicResource Text.CreateBranch.LocalChanges.DoNothing}"
|
||||||
|
x:Name="RadioDoNothing"
|
||||||
GroupName="LocalChanges"
|
GroupName="LocalChanges"
|
||||||
Margin="0,0,8,0"
|
Margin="0,0,8,0"
|
||||||
IsChecked="{Binding PreAction, Mode=TwoWay, Converter={StaticResource EnumToBoolConverter}, ConverterParameter={x:Static m:DealWithLocalChanges.DoNothing}}"/>
|
IsCheckedChanged="OnLocalChangeActionIsCheckedChanged"/>
|
||||||
<RadioButton Content="{DynamicResource Text.CreateBranch.LocalChanges.StashAndReply}"
|
<RadioButton Content="{DynamicResource Text.CreateBranch.LocalChanges.StashAndReply}"
|
||||||
|
x:Name="RadioStashAndReply"
|
||||||
GroupName="LocalChanges"
|
GroupName="LocalChanges"
|
||||||
Margin="0,0,8,0"
|
Margin="0,0,8,0"
|
||||||
IsChecked="{Binding PreAction, Mode=TwoWay, Converter={StaticResource EnumToBoolConverter}, ConverterParameter={x:Static m:DealWithLocalChanges.StashAndReaply}}"/>
|
IsCheckedChanged="OnLocalChangeActionIsCheckedChanged"/>
|
||||||
<RadioButton Content="{DynamicResource Text.CreateBranch.LocalChanges.Discard}"
|
<RadioButton Content="{DynamicResource Text.CreateBranch.LocalChanges.Discard}"
|
||||||
|
x:Name="RadioDiscard"
|
||||||
GroupName="LocalChanges"
|
GroupName="LocalChanges"
|
||||||
IsChecked="{Binding PreAction, Mode=TwoWay, Converter={StaticResource EnumToBoolConverter}, ConverterParameter={x:Static m:DealWithLocalChanges.Discard}}"/>
|
IsCheckedChanged="OnLocalChangeActionIsCheckedChanged"/>
|
||||||
</WrapPanel>
|
</WrapPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
|
using Avalonia.Interactivity;
|
||||||
|
|
||||||
namespace SourceGit.Views
|
namespace SourceGit.Views
|
||||||
{
|
{
|
||||||
|
@ -8,5 +9,51 @@ namespace SourceGit.Views
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void OnLoaded(RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
base.OnLoaded(e);
|
||||||
|
|
||||||
|
var vm = DataContext as ViewModels.Checkout;
|
||||||
|
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.Checkout;
|
||||||
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,21 +69,20 @@
|
||||||
Margin="0,0,8,0"
|
Margin="0,0,8,0"
|
||||||
Text="{DynamicResource Text.CreateBranch.LocalChanges}"/>
|
Text="{DynamicResource Text.CreateBranch.LocalChanges}"/>
|
||||||
<WrapPanel Grid.Row="2" Grid.Column="1" Orientation="Horizontal" VerticalAlignment="Center">
|
<WrapPanel Grid.Row="2" Grid.Column="1" Orientation="Horizontal" VerticalAlignment="Center">
|
||||||
<WrapPanel.Resources>
|
|
||||||
<ac:EnumToBoolConverter x:Key="EnumToBoolConverter"/>
|
|
||||||
</WrapPanel.Resources>
|
|
||||||
|
|
||||||
<RadioButton Content="{DynamicResource Text.CreateBranch.LocalChanges.DoNothing}"
|
<RadioButton Content="{DynamicResource Text.CreateBranch.LocalChanges.DoNothing}"
|
||||||
|
x:Name="RadioDoNothing"
|
||||||
GroupName="LocalChanges"
|
GroupName="LocalChanges"
|
||||||
Margin="0,0,8,0"
|
Margin="0,0,8,0"
|
||||||
IsChecked="{Binding PreAction, Mode=TwoWay, Converter={StaticResource EnumToBoolConverter}, ConverterParameter={x:Static m:DealWithLocalChanges.DoNothing}}"/>
|
IsCheckedChanged="OnLocalChangeActionIsCheckedChanged"/>
|
||||||
<RadioButton Content="{DynamicResource Text.CreateBranch.LocalChanges.StashAndReply}"
|
<RadioButton Content="{DynamicResource Text.CreateBranch.LocalChanges.StashAndReply}"
|
||||||
|
x:Name="RadioStashAndReply"
|
||||||
GroupName="LocalChanges"
|
GroupName="LocalChanges"
|
||||||
Margin="0,0,8,0"
|
Margin="0,0,8,0"
|
||||||
IsChecked="{Binding PreAction, Mode=TwoWay, Converter={StaticResource EnumToBoolConverter}, ConverterParameter={x:Static m:DealWithLocalChanges.StashAndReaply}}"/>
|
IsCheckedChanged="OnLocalChangeActionIsCheckedChanged"/>
|
||||||
<RadioButton Content="{DynamicResource Text.CreateBranch.LocalChanges.Discard}"
|
<RadioButton Content="{DynamicResource Text.CreateBranch.LocalChanges.Discard}"
|
||||||
|
x:Name="RadioDiscard"
|
||||||
GroupName="LocalChanges"
|
GroupName="LocalChanges"
|
||||||
IsChecked="{Binding PreAction, Mode=TwoWay, Converter={StaticResource EnumToBoolConverter}, ConverterParameter={x:Static m:DealWithLocalChanges.Discard}}"/>
|
IsCheckedChanged="OnLocalChangeActionIsCheckedChanged"/>
|
||||||
</WrapPanel>
|
</WrapPanel>
|
||||||
|
|
||||||
<CheckBox Grid.Row="3" Grid.Column="1"
|
<CheckBox Grid.Row="3" Grid.Column="1"
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
|
using Avalonia.Interactivity;
|
||||||
|
|
||||||
namespace SourceGit.Views
|
namespace SourceGit.Views
|
||||||
{
|
{
|
||||||
|
@ -8,5 +9,51 @@ namespace SourceGit.Views
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,21 +77,20 @@
|
||||||
Margin="0,0,8,0"
|
Margin="0,0,8,0"
|
||||||
Text="{DynamicResource Text.Pull.LocalChanges}"/>
|
Text="{DynamicResource Text.Pull.LocalChanges}"/>
|
||||||
<WrapPanel Grid.Row="3" Grid.Column="1" Orientation="Horizontal" VerticalAlignment="Center">
|
<WrapPanel Grid.Row="3" Grid.Column="1" Orientation="Horizontal" VerticalAlignment="Center">
|
||||||
<WrapPanel.Resources>
|
|
||||||
<ac:EnumToBoolConverter x:Key="EnumToBoolConverter"/>
|
|
||||||
</WrapPanel.Resources>
|
|
||||||
|
|
||||||
<RadioButton Content="{DynamicResource Text.Pull.LocalChanges.DoNothing}"
|
<RadioButton Content="{DynamicResource Text.Pull.LocalChanges.DoNothing}"
|
||||||
|
x:Name="RadioDoNothing"
|
||||||
Margin="0,0,8,0"
|
Margin="0,0,8,0"
|
||||||
GroupName="LocalChanges"
|
GroupName="LocalChanges"
|
||||||
IsChecked="{Binding PreAction, Mode=TwoWay, Converter={StaticResource EnumToBoolConverter}, ConverterParameter={x:Static m:DealWithLocalChanges.DoNothing}}"/>
|
IsCheckedChanged="OnLocalChangeActionIsCheckedChanged"/>
|
||||||
<RadioButton Content="{DynamicResource Text.Pull.LocalChanges.StashAndReply}"
|
<RadioButton Content="{DynamicResource Text.Pull.LocalChanges.StashAndReply}"
|
||||||
|
x:Name="RadioStashAndReply"
|
||||||
Margin="0,0,8,0"
|
Margin="0,0,8,0"
|
||||||
GroupName="LocalChanges"
|
GroupName="LocalChanges"
|
||||||
IsChecked="{Binding PreAction, Mode=TwoWay, Converter={StaticResource EnumToBoolConverter}, ConverterParameter={x:Static m:DealWithLocalChanges.StashAndReaply}}"/>
|
IsCheckedChanged="OnLocalChangeActionIsCheckedChanged"/>
|
||||||
<RadioButton Content="{DynamicResource Text.Pull.LocalChanges.Discard}"
|
<RadioButton Content="{DynamicResource Text.Pull.LocalChanges.Discard}"
|
||||||
|
x:Name="RadioDiscard"
|
||||||
GroupName="LocalChanges"
|
GroupName="LocalChanges"
|
||||||
IsChecked="{Binding PreAction, Mode=TwoWay, Converter={StaticResource EnumToBoolConverter}, ConverterParameter={x:Static m:DealWithLocalChanges.Discard}}"/>
|
IsCheckedChanged="OnLocalChangeActionIsCheckedChanged"/>
|
||||||
</WrapPanel>
|
</WrapPanel>
|
||||||
|
|
||||||
<CheckBox Grid.Row="4" Grid.Column="1"
|
<CheckBox Grid.Row="4" Grid.Column="1"
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
|
using Avalonia.Interactivity;
|
||||||
|
|
||||||
namespace SourceGit.Views
|
namespace SourceGit.Views
|
||||||
{
|
{
|
||||||
|
@ -8,5 +9,51 @@ namespace SourceGit.Views
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void OnLoaded(RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
base.OnLoaded(e);
|
||||||
|
|
||||||
|
var vm = DataContext as ViewModels.Pull;
|
||||||
|
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.Pull;
|
||||||
|
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…
Reference in a new issue