mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-11-01 13:13:21 -07:00
96d4150d26
* remove dotnet-tool.json because the project does not rely on any dotnet tools. * remove Directory.Build.props because the solution has only one project. * move src/SourceGit to src. It's not needed to put all sources into a subfolder of src since there's only one project.
49 lines
1.6 KiB
C#
49 lines
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;
|
|
}
|
|
}
|
|
}
|