public string Show(IWin32Window owner, string text, string caption, MessageBoxButtonsBA buttons, MessageBoxIconBA icon) { MessageBoxManager.GetMessageButton(); _msgBox = new MessageBoxForm(); try { if (_useSavedResponse && this.Name != null) { string savedResponse = MessageBoxManager.GetSavedResponse(this); if (savedResponse != null) { return(savedResponse); } } _msgBox.ClearButtons(); this.AddButtons(buttons); this.Caption = caption; this.Text = text; this.Icon = icon; if (owner == null) { _msgBox.ShowDialog(); } else { _msgBox.ShowDialog(owner); } if (this.Name != null) { if (_msgBox.AllowSaveResponse && _msgBox.SaveResponse) { MessageBoxManager.SetSavedResponse(this, _msgBox.Result); } else { MessageBoxManager.ResetSavedResponse(this.Name); } } else { Dispose(); } } catch { } return(_msgBox.Result); }
/// <summary> /// Shows the messsage box with the specified owner /// </summary> public string Show(IWin32Window owner) { MessageBoxManager.GetMessageButton(); _msgBox = new MessageBoxForm(); if (_useSavedResponse && this.Name != null) { string savedResponse = MessageBoxManager.GetSavedResponse(this); if (savedResponse != null) { return(savedResponse); } } _msgBox.ClearButtons(); this.AddButton(MessageBoxButtonsBA.OK); this.Caption = string.Empty; this.Text = string.Empty; this.Icon = MessageBoxIconBA.Information; if (owner == null) { _msgBox.ShowDialog(); } else { _msgBox.ShowDialog(owner); } if (this.Name != null) { if (_msgBox.AllowSaveResponse && _msgBox.SaveResponse) { MessageBoxManager.SetSavedResponse(this, _msgBox.Result); } else { MessageBoxManager.ResetSavedResponse(this.Name); } } else { Dispose(); } return(_msgBox.Result); }