| 1234567891011121314151617181920212223242526272829303132333435363738394041 |
- using Avalonia;
- using Avalonia.Controls;
- using Avalonia.Input;
- using Avalonia.Interactivity;
- using Avalonia.Markup.Xaml;
- namespace PRS.Avalonia.Modules;
- public partial class SubmitDocsView : UserControl
- {
- public SubmitDocsView()
- {
- InitializeComponent();
- }
- private Button? _heldButton;
- private void Button_Holding(object? sender, HoldingRoutedEventArgs e)
- {
- if (sender is not Button button || button.Tag is not DataEntryDocumentShell shell) return;
- if(e.HoldingState == HoldingState.Started)
- {
- _heldButton = button;
- (DataContext as SubmitDocsViewModel)?.HoldCommand.Execute(shell);
- }
- }
- private void Button_Click(object? sender, RoutedEventArgs e)
- {
- if (sender is not Button button || button.Tag is not DataEntryDocumentShell shell) return;
- if(button == _heldButton)
- {
- // Disable the click event if we held the button.
- _heldButton = null;
- return;
- }
- (DataContext as SubmitDocsViewModel)?.ClickCommand.Execute(shell);
- }
- }
|