2024-02-05 23:08:37 -08:00
|
|
|
using Avalonia.Controls;
|
2024-05-28 06:19:53 -07:00
|
|
|
using Avalonia.Interactivity;
|
2024-02-05 23:08:37 -08:00
|
|
|
|
2024-03-17 18:37:06 -07:00
|
|
|
namespace SourceGit.Views
|
|
|
|
{
|
|
|
|
public partial class CommitDetail : UserControl
|
|
|
|
{
|
|
|
|
public CommitDetail()
|
|
|
|
{
|
2024-02-05 23:08:37 -08:00
|
|
|
InitializeComponent();
|
|
|
|
}
|
|
|
|
|
2024-05-28 06:19:53 -07:00
|
|
|
private void OnChangeListContextRequested(object sender, ContextRequestedEventArgs e)
|
2024-03-17 18:37:06 -07:00
|
|
|
{
|
2024-05-28 06:19:53 -07:00
|
|
|
if (DataContext is ViewModels.CommitDetail vm && sender is ChangeCollectionView view)
|
2024-03-17 18:37:06 -07:00
|
|
|
{
|
2024-05-28 06:19:53 -07:00
|
|
|
var selected = view.SelectedChanges;
|
|
|
|
if (selected != null && selected.Count == 1)
|
|
|
|
{
|
|
|
|
var menu = vm.CreateChangeContextMenu(selected[0]);
|
|
|
|
view.OpenContextMenu(menu);
|
|
|
|
}
|
2024-02-05 23:08:37 -08:00
|
|
|
}
|
|
|
|
e.Handled = true;
|
|
|
|
}
|
|
|
|
|
2024-05-28 06:19:53 -07:00
|
|
|
private void OnChangeDoubleTapped(object sender, RoutedEventArgs e)
|
2024-03-17 18:37:06 -07:00
|
|
|
{
|
2024-05-28 06:19:53 -07:00
|
|
|
if (DataContext is ViewModels.CommitDetail vm && sender is ChangeCollectionView view)
|
2024-03-17 18:37:06 -07:00
|
|
|
{
|
2024-05-28 06:19:53 -07:00
|
|
|
var selected = view.SelectedChanges;
|
|
|
|
if (selected != null && selected.Count == 1)
|
2024-03-17 18:37:06 -07:00
|
|
|
{
|
2024-05-28 06:19:53 -07:00
|
|
|
vm.ActivePageIndex = 1;
|
|
|
|
vm.SelectedChanges = new() { selected[0] };
|
2024-03-02 07:44:49 -08:00
|
|
|
}
|
2024-02-05 23:08:37 -08:00
|
|
|
}
|
|
|
|
e.Handled = true;
|
|
|
|
}
|
|
|
|
}
|
2024-03-31 01:54:29 -07:00
|
|
|
}
|