| 1 | using System.Windows.Input; |
| 2 | using Avalonia; |
| 3 | using Avalonia.Controls; |
| 4 | using Avalonia.Interactivity; |
| 5 | |
| 6 | namespace CascadeIDE.Views.UiKit; |
| 7 | |
| 8 | public partial class EcamSoftKeyBar : UserControl |
| 9 | { |
| 10 | public static readonly StyledProperty<string> Button1TextProperty = |
| 11 | AvaloniaProperty.Register<EcamSoftKeyBar, string>(nameof(Button1Text), defaultValue: "BTN1"); |
| 12 | public static readonly StyledProperty<ICommand?> Button1CommandProperty = |
| 13 | AvaloniaProperty.Register<EcamSoftKeyBar, ICommand?>(nameof(Button1Command)); |
| 14 | |
| 15 | public static readonly StyledProperty<string> Button2TextProperty = |
| 16 | AvaloniaProperty.Register<EcamSoftKeyBar, string>(nameof(Button2Text), defaultValue: "BTN2"); |
| 17 | public static readonly StyledProperty<ICommand?> Button2CommandProperty = |
| 18 | AvaloniaProperty.Register<EcamSoftKeyBar, ICommand?>(nameof(Button2Command)); |
| 19 | |
| 20 | public static readonly StyledProperty<string> Button3TextProperty = |
| 21 | AvaloniaProperty.Register<EcamSoftKeyBar, string>(nameof(Button3Text), defaultValue: "BTN3"); |
| 22 | |
| 23 | public string Button1Text |
| 24 | { |
| 25 | get => GetValue(Button1TextProperty); |
| 26 | set => SetValue(Button1TextProperty, value); |
| 27 | } |
| 28 | |
| 29 | public ICommand? Button1Command |
| 30 | { |
| 31 | get => GetValue(Button1CommandProperty); |
| 32 | set => SetValue(Button1CommandProperty, value); |
| 33 | } |
| 34 | |
| 35 | public string Button2Text |
| 36 | { |
| 37 | get => GetValue(Button2TextProperty); |
| 38 | set => SetValue(Button2TextProperty, value); |
| 39 | } |
| 40 | |
| 41 | public ICommand? Button2Command |
| 42 | { |
| 43 | get => GetValue(Button2CommandProperty); |
| 44 | set => SetValue(Button2CommandProperty, value); |
| 45 | } |
| 46 | |
| 47 | public string Button3Text |
| 48 | { |
| 49 | get => GetValue(Button3TextProperty); |
| 50 | set => SetValue(Button3TextProperty, value); |
| 51 | } |
| 52 | |
| 53 | public EcamSoftKeyBar() |
| 54 | { |
| 55 | InitializeComponent(); |
| 56 | } |
| 57 | |
| 58 | public event EventHandler<RoutedEventArgs>? Button3Click; |
| 59 | |
| 60 | private void OnButton3Click(object? sender, RoutedEventArgs e) |
| 61 | { |
| 62 | Button3Click?.Invoke(this, e); |
| 63 | } |
| 64 | } |
| 65 | |
| 66 | |