コード例 #1
0
        private static async Task ShowExceptionDialog(Exception ex)
        {
            // Creating content dialog
            var dialog = ContentDialogHelper.CreateContentDialog(includeSecondaryButton: false);

            dialog.DefaultButton = ContentDialogButton.Primary;

            dialog.PrimaryButtonText = Application.Current.TryFindResource("OKButtonText") as string;
            dialog.Title             = Application.Current.TryFindResource("ReplayPlayExceptionTitle") as string;
            dialog.SetLabelText(ex.ToString());

            // Make dialog as long as the exception
            var label = dialog.GetContentDialogLabel();

            label.MaxWidth     = 350;
            label.TextWrapping = TextWrapping.Wrap;

            // Make background overlay transparent when in the dialog host window,
            // making the dialog appear seamlessly
            if (Application.Current.MainWindow is DialogHostWindow)
            {
                dialog.SetBackgroundSmokeColor(Brushes.Transparent);
            }

            await dialog.ShowAsync(ContentDialogPlacement.Popup).ConfigureAwait(true);
        }
コード例 #2
0
        private static async Task ShowUnsupportedDialog(string version)
        {
            // Creating content dialog
            var dialog = ContentDialogHelper.CreateContentDialog(includeSecondaryButton: false);

            dialog.DefaultButton = ContentDialogButton.Primary;

            dialog.PrimaryButtonText = Application.Current.TryFindResource("OKButtonText") as string;
            dialog.Title             = Application.Current.TryFindResource("ExecutableNotFoundErrorTitle") as string;
            dialog.SetLabelText(Application.Current.TryFindResource("ExecutableNotFoundErrorText") as string + " " + version);

            // Make background overlay transparent when in the dialog host window,
            // making the dialog appear seamlessly
            if (Application.Current.MainWindow is DialogHostWindow)
            {
                dialog.SetBackgroundSmokeColor(Brushes.Transparent);
            }

            await dialog.ShowAsync(ContentDialogPlacement.Popup).ConfigureAwait(true);
        }
コード例 #3
0
        private static async Task <ContentDialogResult> ShowConfirmationDialog()
        {
            // Creating content dialog
            var dialog = ContentDialogHelper.CreateContentDialog(includeSecondaryButton: true);

            dialog.DefaultButton = ContentDialogButton.Primary;

            dialog.PrimaryButtonText   = Application.Current.TryFindResource("YesText") as string;
            dialog.SecondaryButtonText = Application.Current.TryFindResource("NoText") as string;
            dialog.Title = Application.Current.TryFindResource("ReplayPlayConfirmTitle") as string;
            dialog.SetLabelText(Application.Current.TryFindResource("ReplayPlayConfirmOptOut") as string);

            // Make background overlay transparent when in the dialog host window,
            // making the dialog appear seamlessly
            if (Application.Current.MainWindow is DialogHostWindow)
            {
                dialog.SetBackgroundSmokeColor(Brushes.Transparent);
            }

            return(await dialog.ShowAsync(ContentDialogPlacement.Popup).ConfigureAwait(true));
        }