コード例 #1
0
        private DialogResult ShowMessageBox(string title, string messageText, MessageBoxButtons buttons, MessageBoxIcon boxIcon)
        {
            DialogResult?result;

            if (InvokeRequired)
            {
                ShowMessageBoxCallback c = ShowMessageBox;
                result = Invoke(c, title, messageText, buttons, boxIcon) as DialogResult?;
            }
            else
            {
                result = MessageBox.Show(this, messageText, title, buttons, boxIcon);
            }

            if (result == null)
            {
                throw new Exception("Unexpected error from MessageBox.");
            }

            return((DialogResult)result);
        }
コード例 #2
0
ファイル: MainWindow.cs プロジェクト: ValiMail/dkim-exchange
        private DialogResult ShowMessageBox(string title, string message, MessageBoxButtons buttons, MessageBoxIcon icon)
        {
            DialogResult? result = null;

            if (this.InvokeRequired)
            {
                ShowMessageBoxCallback c = new ShowMessageBoxCallback(this.ShowMessageBox);
                result = this.Invoke(c, new object[] { title, message, buttons, icon }) as DialogResult?;
            }
            else
            {
                result = MessageBox.Show(this, message, title, buttons, icon);
            }

            if (result == null)
            {
                throw new Exception("Unexpected error from MessageBox.");
            }

            return (DialogResult) result;
        }