mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-11-01 13:13:21 -07:00
27 lines
751 B
C#
27 lines
751 B
C#
using Avalonia.Controls;
|
|
|
|
namespace SourceGit.Views
|
|
{
|
|
public partial class CommitChanges : UserControl
|
|
{
|
|
public CommitChanges()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void OnChangeContextRequested(object sender, ContextRequestedEventArgs e)
|
|
{
|
|
if (DataContext is ViewModels.CommitDetail vm)
|
|
{
|
|
var selected = (sender as ChangeCollectionView)?.SelectedChanges;
|
|
if (selected != null && selected.Count == 1)
|
|
{
|
|
var menu = vm.CreateChangeContextMenu(selected[0]);
|
|
(sender as Control)?.OpenContextMenu(menu);
|
|
}
|
|
}
|
|
|
|
e.Handled = true;
|
|
}
|
|
}
|
|
}
|