コード例 #1
0
        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);
            }
        }
コード例 #2
0
 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);
 }
コード例 #3
0
        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);
            }
        }
コード例 #4
0
        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);
            }
        }