示例#1
0
        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);
            }
        }
示例#2
0
 private void SecondaryButton_Click(object sender, RoutedEventArgs e)
 {
     SecondaryButtonCommand?.Execute(SecondaryButtonCommandParameter);
     SecondaryButtonClick?.DynamicInvoke();
     Result = CustomContentDialogResult.Secondary;
     Hide();
 }
示例#3
0
        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);
            }
        }
示例#4
0
        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);
            }
        }