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); }
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; }