sourcegit/src/Views/CommitBaseInfo.axaml.cs

45 lines
1.2 KiB
C#
Raw Normal View History

using Avalonia;
using Avalonia.Controls;
using Avalonia.Input;
namespace SourceGit.Views
{
public partial class CommitBaseInfo : UserControl
{
public static readonly StyledProperty<bool> CanNavigateProperty =
AvaloniaProperty.Register<CommitBaseInfo, bool>(nameof(CanNavigate), true);
public bool CanNavigate
{
get => GetValue(CanNavigateProperty);
set => SetValue(CanNavigateProperty, value);
}
2024-06-13 18:46:30 -07:00
public static readonly StyledProperty<string> MessageProperty =
AvaloniaProperty.Register<CommitBaseInfo, string>(nameof(Message), string.Empty);
public string Message
{
get => GetValue(MessageProperty);
set => SetValue(MessageProperty, value);
}
public CommitBaseInfo()
{
InitializeComponent();
}
private void OnParentSHAPressed(object sender, PointerPressedEventArgs e)
{
2024-07-14 00:55:15 -07:00
if (sender is Control { DataContext: string sha } &&
DataContext is ViewModels.CommitDetail detail &&
CanNavigate)
{
detail.NavigateTo(sha);
}
2024-06-06 00:31:02 -07:00
e.Handled = true;
}
}
}