検索
1|using System; 2|using System.Windows.Forms; 3| 4|namespace net.e_ioo.Common 5|{ 6| internal class MessageInfo 7| { 8| private string _id = null; 9| private string _text = null; 10| private string _title = null; 11| private MessageBoxIcon _icon = MessageBoxIcon.Stop; 12| private MessageBoxButtons _buttons = MessageBoxButtons.OK; 13| private MessageBoxDefaultButton _defaultButton = MessageBoxDefaultButton.Button1; 14| 15| public MessageInfo(string id, string text, string icon, string buttons, string defaultButton) 16| { 17| this._id = id; 18| this._text = text; 19| 20| if(icon.Equals("Information")) { this._icon = MessageBoxIcon.Information; } 21| else if(icon.Equals("Warning")) { this._icon = MessageBoxIcon.Warning; } 22| else if(icon.Equals("Stop")) { this._icon = MessageBoxIcon.Stop; } 23| else if(icon.Equals("Question")){ this._icon = MessageBoxIcon.Question; } 24| else if(icon.Equals("None")) { this._icon = MessageBoxIcon.None; } 25| 26| switch(this._icon){ 27| case MessageBoxIcon.Information: this._title = "情報"; break; 28| case MessageBoxIcon.Warning: this._title = "警告"; break; 29| case MessageBoxIcon.Stop: this._title = "停止"; break; 30| case MessageBoxIcon.Question: this._title = "確認"; break; 31| default: this._title = ""; break; 32| } 33| 34| if(buttons.Equals("AbortRetryIgnore")){ this._buttons = MessageBoxButtons.AbortRetryIgnore; } 35| else if(buttons.Equals("OK")) { this._buttons = MessageBoxButtons.OK; } 36| else if(buttons.Equals("OKCancel")) { this._buttons = MessageBoxButtons.OKCancel; } 37| else if(buttons.Equals("RetryCancel")){ this._buttons = MessageBoxButtons.RetryCancel; } 38| else if(buttons.Equals("YesNo")) { this._buttons = MessageBoxButtons.YesNo; } 39| else if(buttons.Equals("YesNoCancel")){ this._buttons = MessageBoxButtons.YesNoCancel; } 40| 41| if(defaultButton.Equals("Button1")) { this._defaultButton = MessageBoxDefaultButton.Button1; } 42| else if(defaultButton.Equals("Button2")){ this._defaultButton = MessageBoxDefaultButton.Button2; } 43| else if(defaultButton.Equals("Button3")){ this._defaultButton = MessageBoxDefaultButton.Button3; } 44| } 45| 46| public string Id{ 47| get{ return this._id; } 48| } 49| 50| public string Text{ 51| get{ return this._text; } 52| } 53| 54| public string Title{ 55| get{ return this._title; } 56| } 57| 58| public MessageBoxIcon Icon{ 59| get{ return this._icon; } 60| } 61| 62| public MessageBoxButtons Buttons{ 63| get{ return this._buttons; } 64| } 65| 66| public MessageBoxDefaultButton DefaultButton{ 67| get{ return this._defaultButton; } 68| } 69| 70| } 71|}