private void ProcessCloseButton() { void Complete(ContentDialogButtonClickEventArgs a) { if (!a.Cancel) { const ContentDialogResult result = ContentDialogResult.None; CloseButtonCommand.ExecuteIfPossible(CloseButtonCommandParameter); Hide(result); } else { _hiding = false; } } if (_hiding) { return; } _hiding = true; var args = new ContentDialogButtonClickEventArgs(Complete); CloseButtonClick?.Invoke(this, args); if (args.Deferral == null) { Complete(args); } }
private void ProcessCloseButton() { void Complete(ContentDialogButtonClickEventArgs a) { if (!a.Cancel) { const ContentDialogResult result = ContentDialogResult.None; CloseButtonCommand.ExecuteIfPossible(CloseButtonCommandParameter); if (Hide(result)) { _tcs.SetResult(result); } } } var args = new ContentDialogButtonClickEventArgs(Complete); CloseButtonClick?.Invoke(this, args); if (args.Deferral == null) { Complete(args); } }
public LCLGroupBox() { InitializeComponent(); // 为箭头按钮添加快捷菜单 titleBar.btnArrow.Click += (s, e) => { if (TitleBarArrowButtonContextMenu != null) { TitleBarArrowButtonContextMenu.Show(titleBar, titleBar.Width - TitleBarArrowButtonContextMenu.Width, titleBar.Height); } }; // 为关闭键添加单击事件 titleBar.btnClose.Click += (s, e) => { CloseButtonClick?.Invoke(this, e); }; this.ControlAdded += (s, e) => { titleBar.FocusListener.AddChildControl(e.Control); }; this.ControlRemoved += (s, e) => { titleBar.FocusListener.RemoveChildControl(e.Control); }; }
void onCloseButtonClick() { if (CloseButtonClick != null) { CloseButtonClick.Invoke(new object(), new EventArgs()); } }
public ToDoView() { InitializeComponent(); _loadedEventHandler = (s, e) => Loaded?.Invoke(); _addButtonClickHandler = (s, a) => AddButtonClick?.Invoke(); _itemCheckedEventHandler = (s, e) => { if (!_isCheckedProgrammatically) { ToDoItemChecked?.Invoke(((TodoItem)chkListTodo.Items[e.Index]).Id.Value, e.NewValue == CheckState.Checked); } }; _exitButtonClickHandler = (s, e) => CloseButtonClick?.Invoke(); chkListTodo.ItemCheck += _itemCheckedEventHandler; btnAdd.Click += _addButtonClickHandler; btnExit.Click += _exitButtonClickHandler; Load += _loadedEventHandler; chkListTodo.DisplayMember = nameof(TodoItem.Title); }
private void OnCloseButtonClick(object sender, RoutedEventArgs args) { CloseButtonClick?.Invoke(this, null); m_lastCloseReason = InfoBarCloseReason.CloseButton; IsOpen = false; }
private void CloseButton_Click(object sender, RoutedEventArgs e) { CloseButtonClick?.Invoke(this, EventArgs.Empty); }
protected virtual void OnCloseEvent(object sender, RoutedEventArgs e) { CloseButtonClick?.Invoke(sender, e); }