sourcegit/src/Views/CommitChanges.axaml.cs
leo 96d4150d26 project: reorganize the structure of the project.
* 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.
2024-04-02 20:00:33 +08:00

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;
}
}
}