diff --git a/src/ViewModels/Checkout.cs b/src/ViewModels/Checkout.cs index d2fc39b9..9cdbdc16 100644 --- a/src/ViewModels/Checkout.cs +++ b/src/ViewModels/Checkout.cs @@ -9,6 +9,11 @@ namespace SourceGit.ViewModels get => _branch.Name; } + public bool HasLocalChanges + { + get => _repo.LocalChangesCount > 0; + } + public Models.DealWithLocalChanges DealWithLocalChanges { get; diff --git a/src/ViewModels/CheckoutAndFastForward.cs b/src/ViewModels/CheckoutAndFastForward.cs index c80a9a8a..13d9e922 100644 --- a/src/ViewModels/CheckoutAndFastForward.cs +++ b/src/ViewModels/CheckoutAndFastForward.cs @@ -14,6 +14,11 @@ namespace SourceGit.ViewModels get; } + public bool HasLocalChanges + { + get => _repo.LocalChangesCount > 0; + } + public Models.DealWithLocalChanges DealWithLocalChanges { get; diff --git a/src/ViewModels/CheckoutCommit.cs b/src/ViewModels/CheckoutCommit.cs index c8179c23..9f74985e 100644 --- a/src/ViewModels/CheckoutCommit.cs +++ b/src/ViewModels/CheckoutCommit.cs @@ -9,6 +9,11 @@ namespace SourceGit.ViewModels get; } + public bool HasLocalChanges + { + get => _repo.LocalChangesCount > 0; + } + public Models.DealWithLocalChanges DealWithLocalChanges { get; diff --git a/src/ViewModels/Pull.cs b/src/ViewModels/Pull.cs index 4e4fe832..33008bf4 100644 --- a/src/ViewModels/Pull.cs +++ b/src/ViewModels/Pull.cs @@ -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; diff --git a/src/Views/Checkout.axaml b/src/Views/Checkout.axaml index 7d3d12b1..3d91c707 100644 --- a/src/Views/Checkout.axaml +++ b/src/Views/Checkout.axaml @@ -19,12 +19,7 @@ Text="{DynamicResource Text.Checkout}"/> - - - - - - + + VerticalAlignment="Top" + IsVisible="{Binding HasLocalChanges, Mode=OneWay}"> + Method="{Binding DealWithLocalChanges, Mode=TwoWay}" + IsVisible="{Binding HasLocalChanges, Mode=OneWay}"/> diff --git a/src/Views/CheckoutAndFastForward.axaml b/src/Views/CheckoutAndFastForward.axaml index 1a4381df..42fbf544 100644 --- a/src/Views/CheckoutAndFastForward.axaml +++ b/src/Views/CheckoutAndFastForward.axaml @@ -19,13 +19,7 @@ Text="{DynamicResource Text.Checkout.WithFastForward}"/> - - - - - - - + + VerticalAlignment="Top" + IsVisible="{Binding HasLocalChanges, Mode=OneWay}"> + Method="{Binding DealWithLocalChanges, Mode=TwoWay}" + IsVisible="{Binding HasLocalChanges, Mode=OneWay}"/> diff --git a/src/Views/CheckoutCommit.axaml b/src/Views/CheckoutCommit.axaml index fbd73d67..90c506a7 100644 --- a/src/Views/CheckoutCommit.axaml +++ b/src/Views/CheckoutCommit.axaml @@ -19,12 +19,7 @@ Text="{DynamicResource Text.Checkout.Commit}"/> - - - - - - + @@ -42,13 +37,15 @@ + VerticalAlignment="Top" + IsVisible="{Binding HasLocalChanges, Mode=OneWay}"> + Method="{Binding DealWithLocalChanges, Mode=TwoWay}" + IsVisible="{Binding HasLocalChanges, Mode=OneWay}"/> - - - - - - - - - + + VerticalAlignment="Top" + IsVisible="{Binding HasLocalChanges, Mode=OneWay}"> + Method="{Binding DealWithLocalChanges, Mode=TwoWay}" + IsVisible="{Binding HasLocalChanges, Mode=OneWay}"/>