2024-02-05 23:08:37 -08:00
|
|
|
using Avalonia.Controls;
|
|
|
|
|
2024-03-17 18:37:06 -07:00
|
|
|
namespace SourceGit.Views
|
|
|
|
{
|
|
|
|
public partial class CommitChanges : UserControl
|
|
|
|
{
|
|
|
|
public CommitChanges()
|
|
|
|
{
|
2024-02-05 23:08:37 -08:00
|
|
|
InitializeComponent();
|
|
|
|
}
|
|
|
|
|
2024-05-28 06:19:53 -07:00
|
|
|
private void OnChangeContextRequested(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)
|
2024-03-17 18:37:06 -07:00
|
|
|
{
|
2024-05-28 06:19:53 -07:00
|
|
|
var selected = (sender as ChangeCollectionView)?.SelectedChanges;
|
|
|
|
if (selected != null && selected.Count == 1)
|
2024-03-17 18:37:06 -07:00
|
|
|
{
|
2024-05-28 06:19:53 -07:00
|
|
|
var menu = vm.CreateChangeContextMenu(selected[0]);
|
|
|
|
(sender as Control)?.OpenContextMenu(menu);
|
2024-05-29 05:48:51 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
e.Handled = true;
|
|
|
|
}
|
2024-02-05 23:08:37 -08:00
|
|
|
}
|
2024-03-31 01:54:29 -07:00
|
|
|
}
|