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