Added Login validation

This commit is contained in:
TheXamlGuy
2024-06-16 19:19:12 +01:00
parent 8d574362a0
commit 8d76b712be
5 changed files with 92 additions and 40 deletions
@@ -12,12 +12,21 @@ public class KeyBindingTriggerBehaviour :
public static readonly StyledProperty<KeyGesture> GestureProperty =
AvaloniaProperty.Register<KeyBindingTriggerBehaviour, KeyGesture>(nameof(Gesture));
public static readonly StyledProperty<bool> IsEnabledProperty =
AvaloniaProperty.Register<KeyBindingTriggerBehaviour, bool>(nameof(IsEnabled), true);
public KeyGesture Gesture
{
get => GetValue(GestureProperty);
set => SetValue(GestureProperty, value);
}
public bool IsEnabled
{
get => GetValue(IsEnabledProperty);
set => SetValue(IsEnabledProperty, value);
}
public event EventHandler? CanExecuteChanged;
protected override void OnAttached()
@@ -38,6 +47,11 @@ public class KeyBindingTriggerBehaviour :
public bool CanExecute(object? parameter) => true;
public void Execute(object? parameter) =>
Interaction.ExecuteActions(AssociatedObject, Actions, null);
public void Execute(object? parameter)
{
if (IsEnabled)
{
Interaction.ExecuteActions(AssociatedObject, Actions, null);
}
}
}