mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-06-24 11:54:59 +00:00
fix: double click commit checkout
- When a commit was selected and you double tapped an empty section of the histories ListBox, the last selected commit was checkout. - Using the 'TappedEventArgs' properties, and validating the name of the tapped section (PART_ContentPresenter) we can avoid this.
This commit is contained in:
parent
c84845580a
commit
35db764d8d
1 changed files with 11 additions and 1 deletions
|
@ -2,6 +2,7 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
using Avalonia;
|
using Avalonia;
|
||||||
using Avalonia.Collections;
|
using Avalonia.Collections;
|
||||||
|
@ -730,7 +731,16 @@ namespace SourceGit.Views
|
||||||
|
|
||||||
private void OnCommitListDoubleTapped(object sender, TappedEventArgs e)
|
private void OnCommitListDoubleTapped(object sender, TappedEventArgs e)
|
||||||
{
|
{
|
||||||
if (DataContext is ViewModels.Histories histories && sender is ListBox { SelectedItems: { Count: 1 } selected })
|
// Retrieve the PropertyInfo for the "Name" property
|
||||||
|
var nameProperty = e.Source.GetType().GetProperty("Name");
|
||||||
|
|
||||||
|
// Get the value of the "Name" property, or null if it doesn't exist
|
||||||
|
string nameValue = nameProperty?.GetValue(e.Source) as string;
|
||||||
|
|
||||||
|
// Check if has clicked the Background of the ListBox
|
||||||
|
bool isInvalidUiPressed = nameValue == "PART_ContentPresenter";
|
||||||
|
|
||||||
|
if (DataContext is ViewModels.Histories histories && !isInvalidUiPressed && sender is ListBox { SelectedItems: { Count: 1 } selected })
|
||||||
{
|
{
|
||||||
histories.DoubleTapped(selected[0] as Models.Commit);
|
histories.DoubleTapped(selected[0] as Models.Commit);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue