Пример #1
0
        /// <summary>
        /// Handles the <see cref="E:Click" /> event.
        /// </summary>
        /// <param name="args">The <see cref="MouseEventArgs"/> instance containing the event data.</param>
        public async Task OnClick(MouseEventArgs args)
        {
            if (Parent != null)
            {
                var eventArgs = new MenuItemEventArgs
                {
                    Text     = Text,
                    Path     = Path,
                    Value    = Value,
                    AltKey   = args.AltKey,
                    Button   = args.Button,
                    Buttons  = args.Buttons,
                    ClientX  = args.ClientX,
                    ClientY  = args.ClientY,
                    CtrlKey  = args.CtrlKey,
                    Detail   = args.Detail,
                    MetaKey  = args.MetaKey,
                    ScreenX  = args.ScreenX,
                    ScreenY  = args.ScreenY,
                    ShiftKey = args.ShiftKey,
                    Type     = args.Type,
                };
                await Parent.Click.InvokeAsync(eventArgs);

                if (Click.HasDelegate)
                {
                    await Click.InvokeAsync(eventArgs);
                }
            }
        }
 private async void GlobalEventService_KeyUpEvent(object sender, KeyboardInfo e)
 {
     if (ShortcutKey.HasValue && ShortcutKey.IsMatch(e.Key, e.AltKey, e.CtrlKey, e.ShiftKey))
     {
         await InvokeAsync(async() => await Click.InvokeAsync(new MouseEventArgs()).ConfigureAwait(true)).ConfigureAwait(true);
     }
 }
Пример #3
0
        protected async Task ClickHandler()
        {
            await Click.InvokeAsync(null);

            if (Collapsable)
            {
                Visible = !Visible;

                await InvokeAsync(StateHasChanged);

                await Toggled.InvokeAsync(Visible);
            }
        }
        private async Task OnButtonClick(string key)
        {
            if (!(key == "Cancel" && Form?.ConfirmCancel == true && Form.Delta.Count > 0))
            {
                await Click.InvokeAsync(key).ConfigureAwait(true);
            }

            if (Form?.Item != null)
            {
                if (key == "Delete")
                {
                    Form.SetMode(FormModes.Delete);
                }
                else if (key == "Save" && Form.DataProvider != null)
                {
                    await Form.SaveAsync().ConfigureAwait(true);
                }
                else if (key == "Cancel" && Form.ConfirmCancel && Form.Delta.Count > 0)
                {
                    Form.SetMode(FormModes.Cancel);
                }
                else if (key == "Yes" && Form.Mode == FormModes.Delete && Form.DataProvider != null)
                {
                    await Form.DeleteAsync().ConfigureAwait(true);
                }
                else if (key == "Yes" && Form.Mode == FormModes.Cancel)
                {
                    await Click.InvokeAsync("Cancel").ConfigureAwait(true);
                }
                //else if (key == "No" && Form.Mode == FormModes.Delete)
                else if (key == "No")
                {
                    Form.SetMode(Form.PreviousMode, false);
                }
            }
        }
 private void OnRowClick(MouseEventArgs _, TItem item)
 {
     Click.InvokeAsync(item);
 }
 private async Task OnClick()
 {
     await Click.InvokeAsync(Key).ConfigureAwait(true);
 }