private void ProcessPrimaryButton() { void Complete(ContentDialogButtonClickEventArgs a) { if (!a.Cancel) { const ContentDialogResult result = ContentDialogResult.Primary; PrimaryButtonCommand.ExecuteIfPossible(PrimaryButtonCommandParameter); Hide(result); } else { _hiding = false; } } if (_hiding) { return; } _hiding = true; var args = new ContentDialogButtonClickEventArgs(Complete); PrimaryButtonClick?.Invoke(this, args); if (args.Deferral == null) { Complete(args); } }
private void ProcessPrimaryButton() { void Complete(ContentDialogButtonClickEventArgs a) { if (!a.Cancel) { const ContentDialogResult result = ContentDialogResult.Primary; PrimaryButtonCommand.ExecuteIfPossible(PrimaryButtonCommandParameter); if (Hide(result)) { _tcs.SetResult(result); } } } var args = new ContentDialogButtonClickEventArgs(Complete); PrimaryButtonClick?.Invoke(this, args); if (args.Deferral == null) { Complete(args); } }
private void OnPrimaryButtonRoutedExecuted(object sender, ExecutedRoutedEventArgs e) { LightContentDialogButtonClickEventArgs lightContentDialogButtonClickEventArgs = new LightContentDialogButtonClickEventArgs(); PrimaryButtonClick?.Invoke(this, lightContentDialogButtonClickEventArgs); if (!lightContentDialogButtonClickEventArgs.Cancel) { PrimaryButtonCommand?.Execute(PrimaryButtonCommandParameter); tcs.TrySetResult(LightContentDialogResult.Primary); } }
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; } }
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 PrimaryButton_Click(object sender, RoutedEventArgs e) { PrimaryButtonClick?.Invoke(this, e); Close(DialogCloseReason.PrimaryClicked); }
private void PrimaryButton_OnClick(object sender, RoutedEventArgs e) { PrimaryButtonClick?.Invoke(sender, e); }