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-07-02 05:59:28 -07:00
|
|
|
private void OnChangeDoubleTapped(object sender, TappedEventArgs e)
|
2024-03-17 18:37:06 -07:00
|
|
|
{
|
2024-07-02 05:59:28 -07:00
|
|
|
if (DataContext is ViewModels.CommitDetail detail && sender is Grid grid && grid.DataContext is Models.Change change)
|
2024-03-17 18:37:06 -07:00
|
|
|
{
|
2024-06-02 19:06:23 -07:00
|
|
|
detail.ActivePageIndex = 1;
|
2024-07-02 05:59:28 -07:00
|
|
|
detail.SelectedChanges = new() { 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-07-02 05:59:28 -07:00
|
|
|
private void OnChangeContextRequested(object sender, ContextRequestedEventArgs e)
|
2024-03-17 18:37:06 -07:00
|
|
|
{
|
2024-07-02 05:59:28 -07:00
|
|
|
if (DataContext is ViewModels.CommitDetail detail && sender is Grid grid && grid.DataContext is Models.Change change)
|
2024-03-17 18:37:06 -07:00
|
|
|
{
|
2024-07-02 05:59:28 -07:00
|
|
|
var menu = detail.CreateChangeContextMenu(change);
|
|
|
|
grid.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
|
|
|
}
|