private void SecondaryButton_Click(object sender, RoutedEventArgs e) { SecondaryButtonCommand?.Execute(SecondaryButtonCommandParameter); SecondaryButtonClick?.DynamicInvoke(); Result = CustomContentDialogResult.Secondary; Hide(); }
private void ProcessSecondaryButton() { void Complete(ContentDialogButtonClickEventArgs a) { if (!a.Cancel) { const ContentDialogResult result = ContentDialogResult.Secondary; SecondaryButtonCommand.ExecuteIfPossible(SecondaryButtonCommandParameter); Hide(result); } else { _hiding = false; } } if (_hiding) { return; } _hiding = true; var args = new ContentDialogButtonClickEventArgs(Complete); SecondaryButtonClick?.Invoke(this, args); if (args.Deferral == null) { Complete(args); } }
private void SecondaryButtonRoutedExecuted(object sender, ExecutedRoutedEventArgs e) { LightContentDialogButtonClickEventArgs lightContentDialogButtonClickEventArgs = new LightContentDialogButtonClickEventArgs(); SecondaryButtonClick?.Invoke(this, lightContentDialogButtonClickEventArgs); if (!lightContentDialogButtonClickEventArgs.Cancel) { SecondaryButtonCommand?.Execute(SecondaryButtonCommandParameter); tcs.TrySetResult(LightContentDialogResult.Secondary); } }
protected override void OnKeyUp(KeyRoutedEventArgs e) { if (e.Key == Windows.System.VirtualKey.Enter) { Result = ContentDialogResult.Primary; PrimaryButtonClick?.Invoke(this, default(ContentDialogButtonClickEventArgs)); Hide(); } else if (e.Key == Windows.System.VirtualKey.Escape) { Result = ContentDialogResult.Secondary; SecondaryButtonClick?.Invoke(this, default(ContentDialogButtonClickEventArgs)); Hide(); } else { base.OnKeyUp(e); } }
protected override void OnKeyUp(KeyRoutedEventArgs e) { switch (e.Key) { case Windows.System.VirtualKey.Enter: Result = ContentDialogResult.Primary; PrimaryButtonClick?.Invoke(this, default); Hide(); break; case Windows.System.VirtualKey.Escape: Result = ContentDialogResult.Secondary; SecondaryButtonClick?.Invoke(this, default); Hide(); break; default: base.OnKeyUp(e); break; } }
private void ProcessSecondaryButton() { void Complete(ContentDialogButtonClickEventArgs a) { if (!a.Cancel) { _tcs.SetResult(ContentDialogResult.Secondary); SecondaryButtonCommand.ExecuteIfPossible(SecondaryButtonCommandParameter); Hide(); } } var args = new ContentDialogButtonClickEventArgs(Complete); SecondaryButtonClick?.Invoke(this, args); if (args.Deferral == null) { Complete(args); } }
protected override void Invoke(object parameter) { var dlg = new ImageShareDisplayDialog() { Title = Title, Message = Content, PrimaryButtonText = PrimaryText, SecondaryButtonText = SecondaryText }; dlg.ShowDialog(); if (dlg.Result == ImageShareDisplayDialogResult.Primary) { PrimaryButtonClick?.Invoke(this, new EventArgs()); } else if (dlg.Result == ImageShareDisplayDialogResult.Secondary) { SecondaryButtonClick?.Invoke(this, new EventArgs()); } }
private void SecondaryButton_Click(object sender, RoutedEventArgs e) { SecondaryButtonClick?.Invoke(this, e); Close(DialogCloseReason.SecondaryClicked); }
private void SecondaryButton_OnClick(object sender, RoutedEventArgs e) { SecondaryButtonClick?.Invoke(sender, e); }