public Task <string> ShowAsync(string[] buttons, string title, string message, DoNotShowAgainOptions dontShowAgainFlag, string doNotShowAgainCustomText) { return(Task.FromResult(ShowSyncInternal(buttons, title, message, dontShowAgainFlag, doNotShowAgainCustomText))); }
public static void ShowWarning(this string message, string title, DoNotShowAgainOptions doNotShowAgainOption) { New <IUIThread>().PostTo(async() => await New <IPopup>().ShowAsync(PopupButtons.Ok, title, message, doNotShowAgainOption)); }
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)); }
public Task <string> ShowAsync(string[] buttons, string title, string message, DoNotShowAgainOptions dontShowAgain) { return(Task.FromResult(ShowSyncInternal(buttons, title, message, dontShowAgain, null))); }
public Task <PopupButtons> ShowAsync(PopupButtons buttons, string title, string message, DoNotShowAgainOptions dontShowAgainFlag) { return(ShowAsync(buttons, title, message, dontShowAgainFlag, null)); }
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}"); } }
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); }
public Task <PopupButtons> ShowAsync(PopupButtons buttons, string title, string message, DoNotShowAgainOptions doNotShowAgainOption, string doNotShowAgainCustomText) { return(Task.FromResult(PopupButtons.Ok)); }
public Task <string> ShowAsync(string[] buttons, string title, string message, DoNotShowAgainOptions doNotShowAgainOption) { return(Task.FromResult(buttons.First())); }