Example #1
0
        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);
            }
        }
Example #2
0
        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);
            }
        }
Example #3
0
 private void PrimaryButton_Click(object sender, RoutedEventArgs e)
 {
     PrimaryButtonCommand?.Execute(PrimaryButtonCommandParameter);
     PrimaryButtonClick?.DynamicInvoke();
     Result = CustomContentDialogResult.Primary;
     Hide();
 }
Example #4
0
        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);
            }
        }
Example #5
0
 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);
     }
 }
Example #6
0
    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;
        }
    }
Example #7
0
        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);
 }
Example #9
0
 private void PrimaryButton_OnClick(object sender, RoutedEventArgs e)
 {
     PrimaryButtonClick?.Invoke(sender, e);
 }