The 2 implementations can now be switched

Added a bool property DiffView.UseChangeBlocks.
It's not bound from UI yet, but could be used for runtime switching between the two different implementations of prev/next change.
The buttons are now using the OnGoto[Prev|Next]Change Click-handler, regardless of implementation.
This commit is contained in:
goran-w 2024-11-16 18:39:04 +01:00
parent 52550fe53e
commit b72f701324

View file

@ -11,7 +11,16 @@ namespace SourceGit.Views
InitializeComponent();
}
public bool UseChangeBlocks { get; set; } = true;
private void OnGotoPrevChange(object _, RoutedEventArgs e)
{
if (UseChangeBlocks)
{
if (DataContext is ViewModels.DiffContext diffCtx)
diffCtx.PrevChange();
}
else
{
var textDiff = this.FindDescendantOfType<ThemedTextDiffPresenter>();
if (textDiff == null)
@ -23,8 +32,16 @@ namespace SourceGit.Views
e.Handled = true;
}
}
private void OnGotoNextChange(object _, RoutedEventArgs e)
{
if (UseChangeBlocks)
{
if (DataContext is ViewModels.DiffContext diffCtx)
diffCtx.NextChange();
}
else
{
var textDiff = this.FindDescendantOfType<ThemedTextDiffPresenter>();
if (textDiff == null)
@ -37,4 +54,5 @@ namespace SourceGit.Views
e.Handled = true;
}
}
}
}