2024-05-28 21:50:26 -07:00
|
|
|
using Avalonia;
|
2024-02-05 23:08:37 -08:00
|
|
|
using Avalonia.Controls;
|
|
|
|
using Avalonia.Input;
|
|
|
|
|
2024-03-17 18:37:06 -07:00
|
|
|
namespace SourceGit.Views
|
|
|
|
{
|
|
|
|
public partial class CommitBaseInfo : UserControl
|
|
|
|
{
|
2024-05-28 21:50:26 -07:00
|
|
|
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-07 21:19:48 -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);
|
|
|
|
}
|
2024-05-28 21:50:26 -07:00
|
|
|
|
2024-03-17 18:37:06 -07:00
|
|
|
public CommitBaseInfo()
|
|
|
|
{
|
2024-02-05 23:08:37 -08:00
|
|
|
InitializeComponent();
|
|
|
|
}
|
|
|
|
|
2024-03-17 18:37:06 -07:00
|
|
|
private void OnParentSHAPressed(object sender, PointerPressedEventArgs e)
|
|
|
|
{
|
2024-05-28 21:50:26 -07:00
|
|
|
if (DataContext is ViewModels.CommitDetail detail && CanNavigate)
|
2024-02-05 23:08:37 -08:00
|
|
|
detail.NavigateTo((sender as Control).DataContext as string);
|
2024-06-06 00:31:02 -07:00
|
|
|
|
2024-02-05 23:08:37 -08:00
|
|
|
e.Handled = true;
|
|
|
|
}
|
|
|
|
}
|
2024-03-31 01:54:29 -07:00
|
|
|
}
|