コード例 #1
0
ファイル: Popup.cs プロジェクト: mirsys/axcrypt-playground
 public Task <string> ShowAsync(string[] buttons, string title, string message, DoNotShowAgainOptions dontShowAgainFlag, string doNotShowAgainCustomText)
 {
     return(Task.FromResult(ShowSyncInternal(buttons, title, message, dontShowAgainFlag, doNotShowAgainCustomText)));
 }
コード例 #2
0
 public static void ShowWarning(this string message, string title, DoNotShowAgainOptions doNotShowAgainOption)
 {
     New <IUIThread>().PostTo(async() => await New <IPopup>().ShowAsync(PopupButtons.Ok, title, message, doNotShowAgainOption));
 }
コード例 #3
0
ファイル: Popup.cs プロジェクト: mirsys/axcrypt-playground
        public async Task <PopupButtons> ShowAsync(PopupButtons buttons, string title, string message, DoNotShowAgainOptions dontShowAgainFlag, string doNotShowAgainCustomText)
        {
            string[] stringButtons = GetStringButtons(buttons);
            string   popupResult   = await ShowAsync(stringButtons, title, message, dontShowAgainFlag, doNotShowAgainCustomText);

            return(GetPopupResult(popupResult));
        }
コード例 #4
0
ファイル: Popup.cs プロジェクト: mirsys/axcrypt-playground
 public Task <string> ShowAsync(string[] buttons, string title, string message, DoNotShowAgainOptions dontShowAgain)
 {
     return(Task.FromResult(ShowSyncInternal(buttons, title, message, dontShowAgain, null)));
 }
コード例 #5
0
ファイル: Popup.cs プロジェクト: mirsys/axcrypt-playground
 public Task <PopupButtons> ShowAsync(PopupButtons buttons, string title, string message, DoNotShowAgainOptions dontShowAgainFlag)
 {
     return(ShowAsync(buttons, title, message, dontShowAgainFlag, null));
 }
コード例 #6
0
ファイル: Popup.cs プロジェクト: mirsys/axcrypt-playground
        private string ShowSyncInternalAssumingUiThread(string[] buttons, string title, string message, DoNotShowAgainOptions dontShowAgainFlag, string doNotShowAgainCustomText)
        {
            DialogResult result;

            using (MessageDialog messageDialog = new MessageDialog(_parent, doNotShowAgainCustomText))
            {
                switch (buttons.Length)
                {
                case 1:
                    messageDialog.InitializeButtonTexts(buttons[0], null, null);
                    messageDialog.HideButton1();
                    messageDialog.HideButton2();
                    break;

                case 2:
                    messageDialog.InitializeButtonTexts(buttons[0], buttons[1], null);
                    messageDialog.HideButton2();
                    break;

                case 3:
                    messageDialog.InitializeButtonTexts(buttons[0], buttons[1], buttons[2]);
                    break;

                default:
                    throw new NotSupportedException("Can't display alert dialog(s) with more than 3 buttons!");
                }

                if (dontShowAgainFlag == DoNotShowAgainOptions.None)
                {
                    messageDialog.HideDontShowAgain();
                }

                messageDialog.Text         = title;
                messageDialog.Message.Text = message;

                result = messageDialog.ShowDialog(_parent);

                if (dontShowAgainFlag != DoNotShowAgainOptions.None && messageDialog.dontShowThisAgain.Checked)
                {
                    New <UserSettings>().DoNotShowAgain = New <UserSettings>().DoNotShowAgain | dontShowAgainFlag;
                }
            }

            switch (result)
            {
            case DialogResult.OK:
                return(buttons[0]);

            case DialogResult.Cancel:
                return(buttons.Length > 1 ? buttons[1] : Texts.ButtonCancelText);

            case DialogResult.Abort:
                return(buttons[2]);

            default:
                throw new InvalidOperationException($"Unexpected result from dialog: {result}");
            }
        }
コード例 #7
0
ファイル: Popup.cs プロジェクト: mirsys/axcrypt-playground
        private string ShowSyncInternal(string[] buttons, string title, string message, DoNotShowAgainOptions dontShowAgainFlag, string doNotShowAgainCustomText)
        {
            if (buttons.Length > 3)
            {
                throw new InvalidOperationException($"More than 3 buttons are not supported in a popup dialog.");
            }

            string result = string.Empty;

            if (dontShowAgainFlag != DoNotShowAgainOptions.None && New <UserSettings>().DoNotShowAgain.HasFlag(dontShowAgainFlag))
            {
                return(result);
            }

            New <IUIThread>().SendTo(() => result = ShowSyncInternalAssumingUiThread(buttons, title, message, dontShowAgainFlag, doNotShowAgainCustomText));
            return(result);
        }
コード例 #8
0
 public Task <PopupButtons> ShowAsync(PopupButtons buttons, string title, string message, DoNotShowAgainOptions doNotShowAgainOption, string doNotShowAgainCustomText)
 {
     return(Task.FromResult(PopupButtons.Ok));
 }
コード例 #9
0
 public Task <string> ShowAsync(string[] buttons, string title, string message, DoNotShowAgainOptions doNotShowAgainOption)
 {
     return(Task.FromResult(buttons.First()));
 }