protected virtual void SetIcons(MessageBoxIcon icon) { // 根据文本的内容修改窗体大小 lblContent.MaximumSize = new Size(pnlMsg.Width - (pbDialogIcon.Visible ? pbDialogIcon.Width : 0) - 26 - pnlMsg.Padding.Right, Screen.PrimaryScreen.Bounds.Height); lblContent.AutoSize = true; int newHeight = lblContent.Height; lblContent.AutoSize = false; lblContent.Width = 240; lblContent.Height = newHeight; int change = newHeight + pnlMsg.Padding.Top + pnlMsg.Padding.Bottom - pnlMsg.Height; this.Height = this.Height + change; if (icon == MessageBoxIcon.None) { lblContent.Dock = DockStyle.Fill; pbDialogIcon.Visible = false; pbDialogIcon.Image = null; } else { lblContent.Dock = DockStyle.Right; pbDialogIcon.Visible = true; pbDialogIcon.Location = new Point(20, 8); pbDialogIcon.Image = imagelist[icon.ToString()]; } }
/// <summary> /// /// </summary> /// <param name="msgIcon"></param> private void AddIcon(MessageBoxIcon msgIcon) { switch (msgIcon.ToString()) { case "Exclamation": this.pbxMessage.Image = global::Menporul.Windows.Controls.MenResource.MessageBoxExclamation; break; case "Warning": this.pbxMessage.Image = global::Menporul.Windows.Controls.MenResource.MessageBoxWarning; break; case "Asterisk": this.pbxMessage.Image = global::Menporul.Windows.Controls.MenResource.MessageBoxInformation; break; case "Question": this.pbxMessage.Image = global::Menporul.Windows.Controls.MenResource.MessageBoxQuestion; break; case "Hand": this.pbxMessage.Image = global::Menporul.Windows.Controls.MenResource.MessageBoxError; break; case "None": this.lblMessageWithIcon.Location = this.lblMessage.Location; break; default: break; } }
private static Icon GetMessageBoxIcon(MessageBoxIcon icon) { // Note that the MessageBoxIcon enumeration has several members with the same values (eg. Hand and Stop). switch (icon) { case MessageBoxIcon.Error: return(SystemIcons.Error); case MessageBoxIcon.Information: return(SystemIcons.Information); case MessageBoxIcon.None: return(null); case MessageBoxIcon.Question: return(SystemIcons.Question); case MessageBoxIcon.Warning: return(SystemIcons.Warning); default: Debug.Fail("Unexpected value of MessageBoxIcon: " + icon.ToString()); return(null); } }
public static DialogResult show( string message, MessageBoxIcon boxIcon = MessageBoxIcon.Information, MessageBoxButtons boxButtons = MessageBoxButtons.OK) { return(MessageBox.Show(message, boxIcon.ToString(), boxButtons, boxIcon)); }
private Image CreateIcon(MessageBoxIcon icon) { switch (icon) { case MessageBoxIcon.Asterisk: return(SystemIcons.Asterisk.ToBitmap()); //case MessageBoxIcon.Error: // return SystemIcons.Error.ToBitmap(); case MessageBoxIcon.Exclamation: return(SystemIcons.Exclamation.ToBitmap()); case MessageBoxIcon.Hand: return(SystemIcons.Hand.ToBitmap()); //case MessageBoxIcon.Information: // return SystemIcons.Information.ToBitmap(); //case MessageBoxIcon.None: // return new Bitmap(0, 0); case MessageBoxIcon.Question: return(SystemIcons.Question.ToBitmap()); //case MessageBoxIcon.Stop: // return SystemIcons.Stop.ToBitmap(); //case MessageBoxIcon.Warning: // return SystemIcons.Warning.ToBitmap(); default: Debug.Assert(false, string.Format("Unknown icon type: {0}", icon.ToString())); break; } return(null); }
public void Show( MessageBoxIcon icon, IFormatProvider formatProvider, string format, params object[] args) { var message = string.Format(formatProvider, format, args); Console.Error.WriteLine( string.Concat("[", icon.ToString(), "]: ", message)); }
public ButtonResult Show(MessageBoxIcon icon, IFormatProvider formatProvider, Buttons buttons, string caption, string format, params object[] args) { var message = string.Format(formatProvider, format, args); Console.Error.WriteLine( string.Concat("[", icon.ToString(), "]: ", message)); // todo: how do we want to handle this? // User prompts? Default? return(ButtonResult.None); }
/// <summary> /// Initializes a new instance of the MessageForm class. /// </summary> /// <param name="errorMsg">the error Message</param> /// <param name="headerText">the Header Text</param> /// <param name="errorButtons">errorButtons</param> /// <param name="errorType">errorType</param> public TerraScanMessageBox(string errorMsg, string headerText, MessageBoxButtons errorButtons, MessageBoxIcon errorType) { this.InitializeComponent(); this.formHeaderText = headerText; this.errorMessage = errorMsg.Replace("\\n", "\n"); if (errorButtons.Equals(MessageBoxButtons.OK)) { this.PanelOk.Visible = true; this.PanelYesNo.Visible = false; this.PanelYesNoCancel.Visible = false; this.PanelOkCancel.Visible = false; } else if (errorButtons.Equals(MessageBoxButtons.YesNo)) { this.PanelOk.Visible = false; this.PanelYesNo.Visible = true; this.PanelYesNoCancel.Visible = false; this.PanelOkCancel.Visible = false; } else if (errorButtons.Equals(MessageBoxButtons.YesNoCancel)) { this.PanelOk.Visible = false; this.PanelYesNo.Visible = false; this.PanelYesNoCancel.Visible = true; this.PanelOkCancel.Visible = false; } else if (errorButtons.Equals(MessageBoxButtons.OKCancel)) { this.PanelOk.Visible = false; this.PanelYesNo.Visible = false; this.PanelYesNoCancel.Visible = false; this.PanelOkCancel.Visible = true; } else { this.PanelOk.Visible = false; this.PanelYesNo.Visible = false; this.PanelYesNoCancel.Visible = false; this.PanelOkCancel.Visible = false; } this.MessageLabel.Text = errorMsg; if (this.MessageLabel.Height + 50 >= 120) { this.Height = this.MessageLabel.Height + 100; } else { this.MessageLabel.Height = 153; } this.ErrorTypeIconPictureBox.Image = this.ErrorTypeIconList.Images[errorType.ToString()]; }
private static string GetCaption(string caption, MessageBoxIcon messageIcon) { if (!string.IsNullOrWhiteSpace(caption)) { return(caption); } if (messageIcon != MessageBoxIcon.None) { return(messageIcon.ToString()); } return(string.Empty); }
public static void InsertLog(MessageBoxIcon LogType, Exception e, string StackTrace = "") { XmlDocument XMLLog = new XmlDocument(); XmlElement DOC; if (File.Exists(GetLogPath())) { using (var old = new StreamReader(GetLogPath())) { var s = old.ReadToEnd(); old.Close(); XMLLog.LoadXml(s); } DOC = XMLLog.DocumentElement; } else { DOC = XMLLog.CreateElement("Log"); XMLLog.AppendChild(DOC); } var LogTypeNode = XMLLog.CreateElement(LogType.ToString()); LogTypeNode.SetAttribute("Message", e.Message); LogTypeNode.SetAttribute("Detail", e.GetExceptionDetail().First()); if (StackTrace == "") { LogTypeNode.SetAttribute("StackTrace", e.StackTrace); } else { LogTypeNode.SetAttribute("StackTrace", StackTrace); } LogTypeNode.SetAttribute("DateTime", DateTime.Now.ToString("dd/MM/yyyy hh:mm:ss")); DOC.AppendChild(LogTypeNode); var dir = Path.GetDirectoryName(GetLogPath()); if (!Directory.Exists(dir)) { Directory.CreateDirectory(dir); } XMLLog.Save(GetLogPath()); }
/// <summary> /// An expectation for checking an AlertBox exists. /// </summary> /// <param name="message">The AlertBox message to search for.</param> /// <param name="icon">The AlertBox icon to look for.</param> /// <returns>The first matching AlertBox or <value>null</value> if none found.</returns> private static Func <IWebDriver, AlertBox> AlertBoxExists(string message, MessageBoxIcon icon) { return(driver => { AlertBox[] alertBoxes = ((WisejWebDriver)driver).AlertBoxes; if (alertBoxes != null) { foreach (AlertBox alertBox in alertBoxes) { var matchIcon = false; var matchMessage = false; // check icon type if (icon != MessageBoxIcon.None) { if (icon.ToString().ToUpper() == alertBox.Icon.ToUpper()) { matchIcon = true; } } else { matchIcon = true; } // check message if (!string.IsNullOrEmpty(message)) { if (message == alertBox.Message) { matchMessage = true; } } else { matchMessage = true; } if (matchIcon && matchMessage) { return alertBox; } } } return null; }); }
public ReplyData SendMessage(string text, string caption, MessageBoxButtons boxButtons, MessageBoxIcon icon) { QueryData StatusQueryData = new QueryData(); StatusQueryData.Type = Consts.SectionType.Message; StatusQueryData.CurrClient = m_AppDef.CurrClient; StatusQueryData.ArrCounter.Add(new ObjectMetaData(text, "Text")); StatusQueryData.ArrCounter.Add(new ObjectMetaData(caption, "Caption")); StatusQueryData.ArrCounter.Add(new ObjectMetaData(boxButtons.ToString(), "MessageBoxButtons")); StatusQueryData.ArrCounter.Add(new ObjectMetaData(icon.ToString(), "MessageBoxIcon")); string QueryString = StatusQueryData.Serialize(); //String ReplyString = Comm.SendQuery(i_IP, i_Port, QueryString); String ReplyString = Comm.SendQuery(m_AppDef.CurrClient.IP, m_AppDef.m_Port, QueryString); ReplyData ReplyDataObj = ReplyData.Deserialize(ReplyString); return(ReplyDataObj); }
public static string Show(IWin32Window owner, string messageHtml, MessageBoxButton[] rightButtons, MessageBoxIcon icon = MessageBoxIcon.None) { using (var dlg = new ReactDialog("messageBoxBundle", new { messageHtml, rightButtonDefinitions = rightButtons, icon = icon.ToString().ToLowerInvariant(), closeWithAPICall = true })) { dlg.Width = 500; dlg.Height = 200; // This dialog is neater without a task bar. We don't need to be able to // drag it around. There's nothing left to give it one if we don't set a title // and remove the control box. dlg.ControlBox = false; dlg.ShowDialog(owner); return(dlg.CloseSource); } }
} // proc ShowException private static string GetMessageTitle(MessageBoxIcon icon) { switch (icon) { case MessageBoxIcon.Information: return("Information"); case MessageBoxIcon.Warning: return("Warnung"); case MessageBoxIcon.Question: return("Frage"); case MessageBoxIcon.Error: return("Fehler"); default: return(icon.ToString()); } } // func GetMessageTitle
private static void AddSound(MessageBoxIcon icon) { switch (icon.ToString()) { case "Asterisk": { pictureBox1.Image = System.Drawing.SystemIcons.Asterisk.ToBitmap(); sound = System.Media.SystemSounds.Asterisk; break; } case "Error": { pictureBox1.Image = System.Drawing.SystemIcons.Error.ToBitmap(); sound = System.Media.SystemSounds.Beep; break; } case "Exclamation": { pictureBox1.Image = System.Drawing.SystemIcons.Exclamation.ToBitmap(); sound = System.Media.SystemSounds.Exclamation; break; } case "Hand": { pictureBox1.Image = System.Drawing.SystemIcons.Hand.ToBitmap(); sound = System.Media.SystemSounds.Exclamation; break; } case "Information": { pictureBox1.Image = System.Drawing.SystemIcons.Information.ToBitmap(); sound = System.Media.SystemSounds.Exclamation; break; } case "None": { sound = System.Media.SystemSounds.Asterisk; break; } case "Question": { pictureBox1.Image = System.Drawing.SystemIcons.Question.ToBitmap(); sound = System.Media.SystemSounds.Question; break; } case "Stop": { pictureBox1.Image = System.Drawing.SystemIcons.Error.ToBitmap(); sound = System.Media.SystemSounds.Hand; break; } case "Warning": { pictureBox1.Image = System.Drawing.SystemIcons.Warning.ToBitmap(); sound = System.Media.SystemSounds.Asterisk; break; } } }
/// <summary> /// Parses the specified MessageBoxIcon value. /// </summary> /// <param name="value">The value.</param> /// <returns>The converted value</returns> internal static InformationBoxIcon Parse(MessageBoxIcon value) { return((InformationBoxIcon)Enum.Parse(typeof(InformationBoxIcon), value.ToString())); }
/// <summary> /// Показываем сообщение с иконкой и заголовком сообщения /// </summary> /// <param name="icon"> из пространства имен MessageBoxIcon</param> public void Show(MessageBoxIcon icon,string nameForm) { string tCaption=string.Empty; if (header!=null) tCaption+=header+" "; if (icon!=MessageBoxIcon.None) { switch(icon.ToString()) { case "Error" : case "Hand" : tCaption+="Ошибка!";break; case "Information" : tCaption+="Информация!";break; case "Question" : case "Asterisk" : tCaption+="Вопрос!";break; case "Stop" : tCaption+="Остановитесь!";break; case "Warning" : tCaption+="Внимание!";break; } } if (nameForm!=null && nameForm.Length>0) tCaption=nameForm+" : "+tCaption; if (tCaption!=string.Empty && text.Length>0) MessageBox.Show (text,tCaption,MessageBoxButtons.OK,icon); else if(description.Length>0) MessageBox.Show (description,text,MessageBoxButtons.OK,MessageBoxIcon.Error); else MessageBox.Show (text,"",MessageBoxButtons.OK,MessageBoxIcon.Error); }
/// <summary> /// An expectation for checking a message box exists. /// </summary> /// <param name="message">The message to search for. Null to ignore the message check.</param> /// <param name="title">The title of message box to search for. Null to ignore the title check.</param> /// <param name="icon">The MessageBox icon to look for. MessageBoxIcon.None to ignore the icon check.</param> /// <returns>The first matching MessageBox or <value>null</value> if none found.</returns> private static Func <IWebDriver, MessageBox> MessageBoxExists(string message, string title, MessageBoxIcon icon) { return(driver => { MessageBox[] messagesBoxes = ((WisejWebDriver)driver).MessageBoxes; if (messagesBoxes != null) { foreach (MessageBox messageBox in messagesBoxes) { var matchTitle = false; var matchIcon = false; var matchMessage = false; // check title if (title != null) { if (title == messageBox.Title) { matchTitle = true; } } else { matchTitle = true; } // check icon type if (icon != MessageBoxIcon.None) { if (icon.ToString().ToUpper() == messageBox.Icon.ToUpper()) { matchIcon = true; } } else { matchIcon = true; } // check message if (message != null) { if (message == messageBox.Message) { matchMessage = true; } } else { matchMessage = true; } if (matchIcon && matchTitle && matchMessage) { return messageBox; } } } return null; }); }
internal MessageBox2Form(Form objOwner, string strText, string strCaption, MessageBoxButtons enmButtons, MessageBoxIcon enmIcon, MessageBoxDefaultButton enmDefaultButton, MessageBoxOptions enmOptions, Font font = null) : base(objOwner == null ? ((Form)Global.Context.ActiveForm).Context : objOwner.Context) { InitializeComponent(); Font defaultFont = objOwner == null ? null : objOwner.Font; if (font != null) { defaultFont = font; } menmButtons = enmButtons; menmDefaultButton = enmDefaultButton; int intButtonCount = 0; #region Buttons this.AddTableLayoutRowStyle(this.mobjButtonsLayout, new RowStyle(SizeType.Absolute, 26F)); this.AddTableLayoutColumnStyle(this.mobjButtonsLayout, new ColumnStyle(SizeType.Percent, 50F)); #region Button1 intButtonCount++; // Resetting the AcceptButton and CancelButton properties of the Form. this.AcceptButton = this.CancelButton = null; // Set the first button. this.mobjButton1 = new MessageBoxButton(); switch (menmButtons) { case MessageBoxButtons.OK: this.mobjButton1.Text = WGLabels.Ok; this.mobjButton1.DialogResult = DialogResult.OK; // Setting the AcceptButton and CancelButton to their relevant buttons. this.AcceptButton = mobjButton1; this.CancelButton = mobjButton1; // Using the newly created separate break; case MessageBoxButtons.OKCancel: this.mobjButton1.Text = WGLabels.Ok; this.mobjButton1.DialogResult = DialogResult.OK; // Setting the AcceptButton to it's relevant button. this.AcceptButton = mobjButton1; break; case MessageBoxButtons.AbortRetryIgnore: this.mobjButton1.Text = WGLabels.Abort; this.mobjButton1.DialogResult = DialogResult.Abort; break; case MessageBoxButtons.RetryCancel: this.mobjButton1.Text = WGLabels.Retry; this.mobjButton1.DialogResult = DialogResult.Retry; break; case MessageBoxButtons.YesNo: case MessageBoxButtons.YesNoCancel: this.mobjButton1.Text = WGLabels.Yes; this.mobjButton1.DialogResult = DialogResult.Yes; //this.mobjButton3 = null; break; } this.AddTableLayoutColumnStyle(this.mobjButtonsLayout, new ColumnStyle(SizeType.Absolute, 76F)); this.mobjButtonsLayout.Controls.Add(this.mobjButton1, 1, 0); #endregion #region Button2 // Add the second button only if not OK. if (menmButtons != MessageBoxButtons.OK) { intButtonCount++; this.mobjButton2 = new MessageBoxButton(); switch (menmButtons) { case MessageBoxButtons.OKCancel: case MessageBoxButtons.RetryCancel: this.mobjButton2.Text = WGLabels.Cancel; this.mobjButton2.DialogResult = DialogResult.Cancel; // Setting the CancelButton to it's relevant button. this.CancelButton = mobjButton2; break; case MessageBoxButtons.AbortRetryIgnore: this.mobjButton2.Text = WGLabels.Retry; this.mobjButton2.DialogResult = DialogResult.Retry; break; case MessageBoxButtons.YesNo: case MessageBoxButtons.YesNoCancel: this.mobjButton2.Text = WGLabels.No; this.mobjButton2.DialogResult = DialogResult.No; break; } this.AddTableLayoutColumnStyle(this.mobjButtonsLayout, new ColumnStyle(SizeType.Absolute, 6F)); this.AddTableLayoutColumnStyle(this.mobjButtonsLayout, new ColumnStyle(SizeType.Absolute, 76F)); this.mobjButtonsLayout.Controls.Add(this.mobjButton2, 3, 0); } #endregion #region Button3 // Add the third button if is needed. if (menmButtons == MessageBoxButtons.AbortRetryIgnore || menmButtons == MessageBoxButtons.YesNoCancel) { intButtonCount++; this.mobjButton3 = new MessageBoxButton(); switch (menmButtons) { case MessageBoxButtons.AbortRetryIgnore: this.mobjButton3.Text = WGLabels.Ignore; this.mobjButton3.DialogResult = DialogResult.Ignore; break; case MessageBoxButtons.YesNoCancel: this.mobjButton3.Text = WGLabels.Cancel; this.mobjButton3.DialogResult = DialogResult.Cancel; // Setting the CancelButton to it's relevant button. this.CancelButton = mobjButton3; break; } this.AddTableLayoutColumnStyle(this.mobjButtonsLayout, new ColumnStyle(SizeType.Absolute, 6F)); this.AddTableLayoutColumnStyle(this.mobjButtonsLayout, new ColumnStyle(SizeType.Absolute, 76F)); this.mobjButtonsLayout.Controls.Add(this.mobjButton3, 5, 0); } #endregion this.AddTableLayoutColumnStyle(this.mobjButtonsLayout, new ColumnStyle(SizeType.Percent, 50F)); #endregion #region Icon if (enmIcon != MessageBoxIcon.None) { this.mobjLabelText.Text = enmIcon.ToString(); mobjIcon.Image = new SkinResourceHandle(typeof(MessageBox), enmIcon.ToString() + ".gif"); } else { // Remove icon layout this.Controls.Remove(this.mobjIconLayout); } #endregion #region Texts // Set description and caption - text values. this.mobjLabelText.Text = strText; this.Text = strCaption; if (this.Context != null && this.Context.MainForm != null) { objOwner = this.Context.MainForm as Form; } // Measure the description's text size. Size objTextsize = CommonUtils.GetStringMeasurements(strText, this.mobjLabelText.Font, objOwner.Width - (enmIcon == MessageBoxIcon.None ? 0 : mobjIcon.Width)); // Calculate the messagebox sizes. int intWidth = Math.Max(GetMinimalWidthForButtonsLayout(), objTextsize.Width) + (enmIcon == MessageBoxIcon.None ? 0 : mobjIconLayout.Width) + (this.Padding.All * 2); int intHeight = mobjButtonsLayout.Height + Math.Max((enmIcon == MessageBoxIcon.None ? 0 : mobjIcon.Height), objTextsize.Height) + 50; // Set the messagebox's calculated size. this.SuspendLayout(); this.Size = new Size(intWidth, intHeight); this.ClientSize = new Size(intWidth, intHeight); this.ResumeLayout(false); #endregion if (defaultFont != null) { this.Font = defaultFont; if (this.mobjButton1 != null) { this.mobjButton1.Font = defaultFont; } if (this.mobjButton2 != null) { this.mobjButton2.Font = defaultFont; } if (this.mobjButton3 != null) { this.mobjButton3.Font = defaultFont; } if (this.mobjLabelText != null) { this.mobjLabelText.Font = defaultFont; } } if (enmButtons == MessageBoxButtons.YesNo || enmButtons == MessageBoxButtons.AbortRetryIgnore) { this.CloseBox = false; } }
static public void ShowMessageBox(string msg, MessageBoxIcon icon = MessageBoxIcon.Information) { MessageBox.Show("檔案不存在", icon.ToString(), MessageBoxButtons.OK, icon); }
private static void Message(string text, MessageBoxIcon icon) { MessageBox.Show(text, icon.ToString(), MessageBoxButtons.OK, icon); }
//private static CustomExceptionFormTypes _customExceptionFormType = CustomExceptionFormTypes.MessageBox; ///// <summary> ///// გამოიყენება SQL-ში RAISERROR('', 16, 1)-ის დროს. ///// </summary> //public static CustomExceptionFormTypes CustomExceptionFormType //{ // get { return _customExceptionFormType; } // set { _customExceptionFormType = value; } //} //[DllImport("user32.dll")] //private static extern bool MessageBeep(int uType); private static string MessageBoxIconTostring(MessageBoxIcon icon) { return(icon != MessageBoxIcon.None ? icon.ToString() : "Exception"); }
private string GenerateCode() { StringBuilder stringBuilder = new StringBuilder(); if (showMessageBox) { stringBuilder.Append(Constants.CodeGeneratorMsgBoxInst); if (setParent) { stringBuilder.Append(Constants.CodeGeneratorThis); stringBuilder.Append(Constants.CodeGeneratorCommaAndSpace); } stringBuilder.Append(string.IsNullOrEmpty(text) ? Constants.CodeGeneratorNull : ArgumentParser.EscapeArgument(text)); if (!string.IsNullOrEmpty(caption) || boxButtons > 0 || boxIcon > 0 || boxDefaultButton > 0) { stringBuilder.Append(Constants.CodeGeneratorCommaAndSpace); stringBuilder.Append(string.IsNullOrEmpty(caption) ? Constants.CodeGeneratorNull : ArgumentParser.EscapeArgument(caption)); } if (boxButtons > 0 || boxIcon > 0 || formDefaultButton > 0) { stringBuilder.Append(Constants.CodeGeneratorCommaAndSpace); stringBuilder.Append(string.Join(".", new string[] { typeof(MessageBoxButtons).Name, boxButtons.ToString() })); } if (boxIcon > 0 || formDefaultButton > 0) { stringBuilder.Append(Constants.CodeGeneratorCommaAndSpace); stringBuilder.Append(string.Join(".", new string[] { typeof(MessageBoxIcon).Name, boxIcon.ToString() })); } if (boxDefaultButton > 0) { stringBuilder.Append(Constants.CodeGeneratorCommaAndSpace); stringBuilder.Append(string.Join(".", new string[] { typeof(MessageBoxDefaultButton).Name, boxDefaultButton.ToString() })); } stringBuilder.Append(Constants.CodeGeneratorEndBracketAndSemicolon); } else { stringBuilder.Append(Constants.CodeGeneratorMsgFormInst); if (setParent) { stringBuilder.Append(Constants.CodeGeneratorThis); stringBuilder.Append(Constants.CodeGeneratorCommaAndSpace); } stringBuilder.Append(string.IsNullOrEmpty(text) ? Constants.CodeGeneratorNull : ArgumentParser.EscapeArgument(text)); if (!string.IsNullOrEmpty(caption) || formButtons > 0 || formBoxIcon > 0 || formDefaultButton > 0 || centerScreen || showHelpButton || maximumWidth > 0 && maximumWidth != MessageForm.defaultWidth || noWrap) { stringBuilder.Append(Constants.CodeGeneratorCommaAndSpace); stringBuilder.Append(string.IsNullOrEmpty(caption) ? Constants.CodeGeneratorNull : ArgumentParser.EscapeArgument(caption)); } if (formButtons > 0 || formBoxIcon > 0 || formDefaultButton > 0 || centerScreen || showHelpButton || maximumWidth > 0 && maximumWidth != MessageForm.defaultWidth || noWrap) { stringBuilder.Append(Constants.CodeGeneratorCommaAndSpace); stringBuilder.Append(string.Join(".", new string[] { typeof(MessageForm.Buttons).Namespace, typeof(MessageForm.Buttons).Name, formButtons.ToString() })); } if (formBoxIcon > 0 || formDefaultButton > 0 || centerScreen || showHelpButton || maximumWidth > 0 && maximumWidth != MessageForm.defaultWidth || noWrap) { stringBuilder.Append(Constants.CodeGeneratorCommaAndSpace); stringBuilder.Append(string.Join(".", new string[] { typeof(MessageForm.BoxIcon).Namespace, typeof(MessageForm.BoxIcon).Name, formBoxIcon.ToString() })); } if (formDefaultButton > 0 || centerScreen || showHelpButton || maximumWidth > 0 && maximumWidth != MessageForm.defaultWidth || noWrap) { stringBuilder.Append(Constants.CodeGeneratorCommaAndSpace); stringBuilder.Append(string.Join(".", new string[] { typeof(MessageForm.DefaultButton).Namespace, typeof(MessageForm.DefaultButton).Name, formDefaultButton.ToString() })); } if (centerScreen || showHelpButton || maximumWidth > 0 && maximumWidth != MessageForm.defaultWidth || noWrap) { stringBuilder.Append(Constants.CodeGeneratorCommaAndSpace); stringBuilder.Append(centerScreen.ToString().ToLowerInvariant()); } if (showHelpButton || maximumWidth > 0 && maximumWidth != MessageForm.defaultWidth || noWrap) { stringBuilder.Append(Constants.CodeGeneratorCommaAndSpace); stringBuilder.Append(showHelpButton.ToString().ToLowerInvariant()); } if (maximumWidth > 0 && maximumWidth != MessageForm.defaultWidth || noWrap) { stringBuilder.Append(Constants.CodeGeneratorCommaAndSpace); stringBuilder.Append(maximumWidth > 0 && maximumWidth != MessageForm.defaultWidth ? maximumWidth.ToString() : 0.ToString()); } if (noWrap) { stringBuilder.Append(Constants.CodeGeneratorCommaAndSpace); stringBuilder.Append(noWrap.ToString().ToLowerInvariant()); } stringBuilder.AppendLine(Constants.CodeGeneratorEndBracketAndSemicolon); stringBuilder.Append(Constants.CodeGeneratorMsgFormShowDlg); if (setParent) { stringBuilder.Append(Constants.CodeGeneratorThis); } stringBuilder.Append(Constants.CodeGeneratorEndBracketAndSemicolon); } return(stringBuilder.ToString()); }