ux: hide the row to deal with uncommitted local changes when there are no local changes

Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
leo
2026-03-23 14:26:42 +08:00
parent 9c15cc92e1
commit 5f520932a2
8 changed files with 40 additions and 36 deletions

View File

@@ -9,6 +9,11 @@ namespace SourceGit.ViewModels
get => _branch.Name;
}
public bool HasLocalChanges
{
get => _repo.LocalChangesCount > 0;
}
public Models.DealWithLocalChanges DealWithLocalChanges
{
get;

View File

@@ -14,6 +14,11 @@ namespace SourceGit.ViewModels
get;
}
public bool HasLocalChanges
{
get => _repo.LocalChangesCount > 0;
}
public Models.DealWithLocalChanges DealWithLocalChanges
{
get;

View File

@@ -9,6 +9,11 @@ namespace SourceGit.ViewModels
get;
}
public bool HasLocalChanges
{
get => _repo.LocalChangesCount > 0;
}
public Models.DealWithLocalChanges DealWithLocalChanges
{
get;

View File

@@ -38,6 +38,11 @@ namespace SourceGit.ViewModels
set => SetProperty(ref _selectedBranch, value, true);
}
public bool HasLocalChanges
{
get => _repo.LocalChangesCount > 0;
}
public Models.DealWithLocalChanges DealWithLocalChanges
{
get;

View File

@@ -19,12 +19,7 @@
Text="{DynamicResource Text.Checkout}"/>
</StackPanel>
<Grid Margin="0,16,0,0" ColumnDefinitions="140,*">
<Grid.RowDefinitions>
<RowDefinition Height="32"/>
<RowDefinition Height="Auto" MinHeight="32"/>
</Grid.RowDefinitions>
<Grid Margin="0,16,0,0" RowDefinitions="32,Auto" ColumnDefinitions="140,*">
<TextBlock Grid.Row="0" Grid.Column="0"
HorizontalAlignment="Right" VerticalAlignment="Center"
Margin="0,0,8,0"
@@ -36,13 +31,15 @@
<Border Grid.Row="1" Grid.Column="0"
Height="32"
VerticalAlignment="Top">
VerticalAlignment="Top"
IsVisible="{Binding HasLocalChanges, Mode=OneWay}">
<TextBlock HorizontalAlignment="Right" VerticalAlignment="Center"
Margin="0,0,8,0"
Text="{DynamicResource Text.Checkout.LocalChanges}"/>
</Border>
<v:DealWithLocalChangesMethod Grid.Row="1" Grid.Column="1"
Method="{Binding DealWithLocalChanges, Mode=TwoWay}"/>
Method="{Binding DealWithLocalChanges, Mode=TwoWay}"
IsVisible="{Binding HasLocalChanges, Mode=OneWay}"/>
</Grid>
</StackPanel>
</UserControl>

View File

@@ -19,13 +19,7 @@
Text="{DynamicResource Text.Checkout.WithFastForward}"/>
</StackPanel>
<Grid Margin="0,16,0,0" ColumnDefinitions="140,*">
<Grid.RowDefinitions>
<RowDefinition Height="32"/>
<RowDefinition Height="32"/>
<RowDefinition Height="Auto" MinHeight="32"/>
</Grid.RowDefinitions>
<Grid Margin="0,16,0,0" RowDefinitions="32,32,Auto" ColumnDefinitions="140,*">
<TextBlock Grid.Row="0" Grid.Column="0"
HorizontalAlignment="Right" VerticalAlignment="Center"
Margin="0,0,8,0"
@@ -58,13 +52,15 @@
<Border Grid.Row="2" Grid.Column="0"
Height="32"
VerticalAlignment="Top">
VerticalAlignment="Top"
IsVisible="{Binding HasLocalChanges, Mode=OneWay}">
<TextBlock HorizontalAlignment="Right" VerticalAlignment="Center"
Margin="0,0,8,0"
Text="{DynamicResource Text.Checkout.LocalChanges}"/>
</Border>
<v:DealWithLocalChangesMethod Grid.Row="2" Grid.Column="1"
Method="{Binding DealWithLocalChanges, Mode=TwoWay}"/>
Method="{Binding DealWithLocalChanges, Mode=TwoWay}"
IsVisible="{Binding HasLocalChanges, Mode=OneWay}"/>
</Grid>
</StackPanel>
</UserControl>

View File

@@ -19,12 +19,7 @@
Text="{DynamicResource Text.Checkout.Commit}"/>
</StackPanel>
<Grid Margin="0,16,0,0">
<Grid.RowDefinitions>
<RowDefinition Height="32"/>
<RowDefinition Height="Auto" MinHeight="32"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid Margin="0,16,0,0" RowDefinitions="32,Auto,Auto">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" MinWidth="140"/>
<ColumnDefinition Width="*"/>
@@ -42,13 +37,15 @@
<Border Grid.Row="1" Grid.Column="0"
Height="32"
VerticalAlignment="Top">
VerticalAlignment="Top"
IsVisible="{Binding HasLocalChanges, Mode=OneWay}">
<TextBlock HorizontalAlignment="Right" VerticalAlignment="Center"
Margin="0,0,8,0"
Text="{DynamicResource Text.Checkout.LocalChanges}"/>
</Border>
<v:DealWithLocalChangesMethod Grid.Row="1" Grid.Column="1"
Method="{Binding DealWithLocalChanges, Mode=TwoWay}"/>
Method="{Binding DealWithLocalChanges, Mode=TwoWay}"
IsVisible="{Binding HasLocalChanges, Mode=OneWay}"/>
<Grid Grid.Row="2" Grid.Column="1" ColumnDefinitions="Auto,*" Margin="0,6,0,0">
<Path Grid.Column="0"

View File

@@ -19,15 +19,7 @@
Text="{DynamicResource Text.Pull.Title}"/>
</StackPanel>
<Grid Margin="0,16,0,0" ColumnDefinitions="140,*">
<Grid.RowDefinitions>
<RowDefinition Height="32"/>
<RowDefinition Height="32"/>
<RowDefinition Height="32"/>
<RowDefinition Height="Auto" MinHeight="32"/>
<RowDefinition Height="32"/>
</Grid.RowDefinitions>
<Grid Margin="0,16,0,0" RowDefinitions="32,32,32,Auto,32" ColumnDefinitions="140,*">
<TextBlock Grid.Row="0" Grid.Column="0"
HorizontalAlignment="Right" VerticalAlignment="Center"
Margin="0,0,8,0"
@@ -81,13 +73,15 @@
<Border Grid.Row="3" Grid.Column="0"
Height="32"
VerticalAlignment="Top">
VerticalAlignment="Top"
IsVisible="{Binding HasLocalChanges, Mode=OneWay}">
<TextBlock HorizontalAlignment="Right" VerticalAlignment="Center"
Margin="0,0,8,0"
Text="{DynamicResource Text.Pull.LocalChanges}"/>
</Border>
<v:DealWithLocalChangesMethod Grid.Row="3" Grid.Column="1"
Method="{Binding DealWithLocalChanges, Mode=TwoWay}"/>
Method="{Binding DealWithLocalChanges, Mode=TwoWay}"
IsVisible="{Binding HasLocalChanges, Mode=OneWay}"/>
<CheckBox Grid.Row="4" Grid.Column="1"
Content="{DynamicResource Text.Pull.UseRebase}"