mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-26 21:17:20 -08:00
49 lines
No EOL
1.6 KiB
C#
49 lines
No EOL
1.6 KiB
C#
using Avalonia.Controls;
|
|
|
|
namespace SourceGit.Views
|
|
{
|
|
public partial class CommitChanges : UserControl
|
|
{
|
|
public CommitChanges()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void OnDataGridSelectionChanged(object sender, SelectionChangedEventArgs e)
|
|
{
|
|
if (sender is DataGrid datagrid && datagrid.IsVisible && datagrid.SelectedItem != null)
|
|
{
|
|
datagrid.ScrollIntoView(datagrid.SelectedItem, null);
|
|
}
|
|
e.Handled = true;
|
|
}
|
|
|
|
private void OnDataGridContextRequested(object sender, ContextRequestedEventArgs e)
|
|
{
|
|
if (sender is DataGrid datagrid && datagrid.SelectedItem != null)
|
|
{
|
|
var detail = DataContext as ViewModels.CommitDetail;
|
|
var menu = detail.CreateChangeContextMenu(datagrid.SelectedItem as Models.Change);
|
|
menu.Open(datagrid);
|
|
}
|
|
|
|
e.Handled = true;
|
|
}
|
|
|
|
private void OnTreeViewContextRequested(object sender, ContextRequestedEventArgs e)
|
|
{
|
|
if (sender is TreeView view && view.SelectedItem != null)
|
|
{
|
|
var detail = DataContext as ViewModels.CommitDetail;
|
|
var node = view.SelectedItem as ViewModels.FileTreeNode;
|
|
if (node != null && !node.IsFolder)
|
|
{
|
|
var menu = detail.CreateChangeContextMenu(node.Backend as Models.Change);
|
|
menu.Open(view);
|
|
}
|
|
}
|
|
|
|
e.Handled = true;
|
|
}
|
|
}
|
|
} |