示例#1
0
        public void Show(string title, string msg, MsgIcon icon, MsgBtns btns, MsgBoxCloseCallBack callBack)
        {
            if (callBack != null)
            {
                _CallBack = callBack;
            }

            this.msgBlock.Text = msg;
            this.Title         = title;

            switch (icon)
            {
            case MsgIcon.Information:
                this.imgIcon.Source = LoadImage("Images/Message.png");
                break;

            case MsgIcon.StopSign:
                this.imgIcon.Source = LoadImage("Images/StopSign.png");
                break;

            case MsgIcon.Exclamation:
                this.imgIcon.Source = LoadImage("Images/Exclamation.png");
                break;

            case MsgIcon.Question:
                this.imgIcon.Source = LoadImage("Images/Question.png");
                break;

            case MsgIcon.None:
                break;

            default:
                break;
            }

            switch (btns)
            {
            case MsgBtns.OK:
                CreateButtons(new KeyValuePair <string, string>[] { new KeyValuePair <string, string>("OK", "确定") });
                break;

            case MsgBtns.Cancel:
                CreateButtons(new KeyValuePair <string, string>[] { new KeyValuePair <string, string>("Cancel", "取消") });
                break;

            case MsgBtns.OKCancel:
                CreateButtons(new KeyValuePair <string, string>[]
                              { new KeyValuePair <string, string>("OK", "确定"),
                                new KeyValuePair <string, string>("Cancel", "取消") });
                break;

            case MsgBtns.YesNo:
                CreateButtons(new KeyValuePair <string, string>[]
                              { new KeyValuePair <string, string>("Yes", "是"),
                                new KeyValuePair <string, string>("No", "否") });
                break;

            case MsgBtns.YesNoCancel:
                CreateButtons(new KeyValuePair <string, string>[]
                              { new KeyValuePair <string, string>("Yes", "是"),
                                new KeyValuePair <string, string>("No", "否"),
                                new KeyValuePair <string, string>("Cancel", "取消") });
                break;

            case MsgBtns.OKCancelApply:
                CreateButtons(new KeyValuePair <string, string>[]
                              { new KeyValuePair <string, string>("OK", "确定"),
                                new KeyValuePair <string, string>("Cancel", "取消"),
                                new KeyValuePair <string, string>("Apply", "应用") });
                break;

            case MsgBtns.RetryCancel:
                CreateButtons(new KeyValuePair <string, string>[]
                              { new KeyValuePair <string, string>("Retry", "重试"),
                                new KeyValuePair <string, string>("Cancel", "取消") });
                break;

            case MsgBtns.AbortRetryIgnore:
                CreateButtons(new KeyValuePair <string, string>[]
                              { new KeyValuePair <string, string>("Abort", "取消"),
                                new KeyValuePair <string, string>("Retry", "重试"),
                                new KeyValuePair <string, string>("Ignore", "忽略") });
                break;
            }
            base.Show();
        }
示例#2
0
 public void Show(string title, string msg, MsgIcon icon, MsgBoxCloseCallBack callBack)
 {
     Show(title, msg, icon, MsgBtns.OK, callBack);
 }