2024-02-05 23:08:37 -08:00
|
|
|
using Avalonia.Controls;
|
2024-06-02 19:06:23 -07:00
|
|
|
using Avalonia.Input;
|
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-06-02 19:06:23 -07:00
|
|
|
private void OnChangeListDoubleTapped(object sender, TappedEventArgs e)
|
2024-03-17 18:37:06 -07:00
|
|
|
{
|
2024-06-02 19:06:23 -07:00
|
|
|
if (DataContext is ViewModels.CommitDetail detail)
|
2024-03-17 18:37:06 -07:00
|
|
|
{
|
2024-06-02 19:06:23 -07:00
|
|
|
var datagrid = sender as DataGrid;
|
2024-06-19 20:11:09 -07:00
|
|
|
if (datagrid.SelectedItem == null)
|
|
|
|
{
|
|
|
|
e.Handled = true;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2024-06-02 19:06:23 -07:00
|
|
|
detail.ActivePageIndex = 1;
|
2024-06-06 00:31:02 -07:00
|
|
|
detail.SelectedChanges = new() { datagrid.SelectedItem as Models.Change };
|
2024-02-05 23:08:37 -08:00
|
|
|
}
|
2024-06-02 19:06:23 -07:00
|
|
|
|
2024-02-05 23:08:37 -08:00
|
|
|
e.Handled = true;
|
|
|
|
}
|
|
|
|
|
2024-06-02 19:06:23 -07:00
|
|
|
private void OnChangeListContextRequested(object sender, ContextRequestedEventArgs e)
|
2024-03-17 18:37:06 -07:00
|
|
|
{
|
2024-06-02 19:06:23 -07:00
|
|
|
if (DataContext is ViewModels.CommitDetail detail)
|
2024-03-17 18:37:06 -07:00
|
|
|
{
|
2024-06-02 19:06:23 -07:00
|
|
|
var datagrid = sender as DataGrid;
|
|
|
|
if (datagrid.SelectedItem == null)
|
2024-03-17 18:37:06 -07:00
|
|
|
{
|
2024-06-02 19:06:23 -07:00
|
|
|
e.Handled = true;
|
|
|
|
return;
|
2024-03-02 07:44:49 -08:00
|
|
|
}
|
2024-06-02 19:06:23 -07:00
|
|
|
|
|
|
|
var menu = detail.CreateChangeContextMenu(datagrid.SelectedItem as Models.Change);
|
|
|
|
datagrid.OpenContextMenu(menu);
|
2024-02-05 23:08:37 -08:00
|
|
|
}
|
2024-06-02 19:06:23 -07:00
|
|
|
|
2024-02-05 23:08:37 -08:00
|
|
|
e.Handled = true;
|
|
|
|
}
|
|
|
|
}
|
2024-03-31 01:54:29 -07:00
|
|
|
}
|