diff --git a/src/Views/DiffView.axaml.cs b/src/Views/DiffView.axaml.cs index f0824307..9dd27f24 100644 --- a/src/Views/DiffView.axaml.cs +++ b/src/Views/DiffView.axaml.cs @@ -37,7 +37,7 @@ namespace SourceGit.Views private void OnBlockNavigationChanged(object sender, RoutedEventArgs e) { - if (sender is TextDiffView { UseBlockNavigation: true } textDiff) + if (sender is TextDiffView textDiff) BlockNavigationIndicator.Text = textDiff.BlockNavigation?.Indicator ?? string.Empty; } } diff --git a/src/Views/TextDiffView.axaml.cs b/src/Views/TextDiffView.axaml.cs index c55719de..7ce9f288 100644 --- a/src/Views/TextDiffView.axaml.cs +++ b/src/Views/TextDiffView.axaml.cs @@ -1746,25 +1746,25 @@ namespace SourceGit.Views public void GotoFirstChange() { this.FindDescendantOfType()?.GotoFirstChange(); - RaiseEvent(new RoutedEventArgs(BlockNavigationChangedEvent)); + TryRaiseBlockNavigationChanged(); } public void GotoPrevChange() { this.FindDescendantOfType()?.GotoPrevChange(); - RaiseEvent(new RoutedEventArgs(BlockNavigationChangedEvent)); + TryRaiseBlockNavigationChanged(); } public void GotoNextChange() { this.FindDescendantOfType()?.GotoNextChange(); - RaiseEvent(new RoutedEventArgs(BlockNavigationChangedEvent)); + TryRaiseBlockNavigationChanged(); } public void GotoLastChange() { this.FindDescendantOfType()?.GotoLastChange(); - RaiseEvent(new RoutedEventArgs(BlockNavigationChangedEvent)); + TryRaiseBlockNavigationChanged(); } protected override void OnDataContextChanged(EventArgs e) @@ -1818,7 +1818,7 @@ namespace SourceGit.Views else BlockNavigation = null; - RaiseEvent(new RoutedEventArgs(BlockNavigationChangedEvent)); + TryRaiseBlockNavigationChanged(); } private void OnStageChunk(object _1, RoutedEventArgs _2) @@ -1990,5 +1990,11 @@ namespace SourceGit.Views repo.MarkWorkingCopyDirtyManually(); repo.SetWatcherEnabled(true); } + + private void TryRaiseBlockNavigationChanged() + { + if (UseBlockNavigation) + RaiseEvent(new RoutedEventArgs(BlockNavigationChangedEvent)); + } } }