protected static MessageBoxDefaultButton GetDefaultButtonForDefaultButton(AlertDefaultButton alertDefaultButton) { switch (alertDefaultButton) { case AlertDefaultButton.Button1: return(MessageBoxDefaultButton.Button1); case AlertDefaultButton.Button2: return(MessageBoxDefaultButton.Button2); case AlertDefaultButton.Button3: return(MessageBoxDefaultButton.Button3); default: throw new ArgumentException("alertDefaultButton unknown: " + alertDefaultButton); } }
protected override AlertResult ShowInternal(IComponent owner, string text, string caption, AlertButtons alertButtons, AlertLevel alertLevel, AlertDefaultButton defaultButton, bool showInTaskbar) { _logger.LogInformation($"Alert: {text} : {caption}"); return(AlertResult.Positive); }
protected override AlertResult ShowInternal(IComponent owner, string text, string caption, AlertButtons alertButtons, AlertLevel alertLevel, AlertDefaultButton defaultButton, bool showInTaskbar) { Trace.TraceInformation("~~~ {0}", text); MessageBoxButtons type = GetButtonsForButtons(alertButtons); MessageBoxIcon icon = GetIconForAlertLevel(alertLevel); MessageBoxDefaultButton defaultBtn = GetDefaultButtonForDefaultButton(defaultButton); DialogResult result = DialogResult.Cancel; ProgressUtils.InvokeOnUIThread(() => result = MessageBox.Show((IWin32Window)owner, text, caption, type, icon, defaultBtn, showInTaskbar ? MessageBoxOptions.DefaultDesktopOnly : 0)); switch (result) { case DialogResult.OK: case DialogResult.Yes: case DialogResult.Retry: return(AlertResult.Positive); case DialogResult.No: case DialogResult.Abort: return(AlertResult.Negative); default: // DialogResult.Cancel return(AlertResult.Cancel); } }
protected override AlertResult ShowInternal(IComponent owner, string text, string caption, AlertButtons alertButtons, AlertLevel alertLevel, AlertDefaultButton defaultButton, bool showInTaskbar) { Logger.WriteEvent($"Paratext Alert: {text}"); MessageBoxButtons type = GetButtonsForButtons(alertButtons); MessageBoxIcon icon = GetIconForAlertLevel(alertLevel); MessageBoxDefaultButton defaultBtn = GetDefaultButtonForDefaultButton(defaultButton); DialogResult result = MessageBox.Show((IWin32Window)owner, text, caption, type, icon, defaultBtn, showInTaskbar ? MessageBoxOptions.DefaultDesktopOnly : 0); switch (result) { case DialogResult.OK: case DialogResult.Yes: case DialogResult.Retry: return(AlertResult.Positive); case DialogResult.No: case DialogResult.Abort: return(AlertResult.Negative); default: // DialogResult.Cancel return(AlertResult.Cancel); } }