Пример #1
0
        /// <summary>
        /// 自定义消息对话框
        /// 可以设置设置拥有此窗体的窗体
        /// </summary>
        public static string MsgCustomOwned(string message, string title, Form owner, params string[] buttonLabels)
        {
            Dbg("自定义消息框 MsgCustomOwned:" + message + ":标题:" + title + ":样式:" + string.Join(",", buttonLabels));
            string lResult = "";

            if (pDisplayMessageBoxes)
            {
                CustomMsgBox lMsgBox = CustomMsgBox();
                lMsgBox.Owner = owner;
                lResult       = lMsgBox.AskUser(message, title, buttonLabels);
                Dbg("消息对话框结果:" + lResult);
                pLastDbgText = "";
            }
            else
            {
                lResult = buttonLabels[0];
                foreach (string lButtonLabel in buttonLabels)
                {
                    if (lButtonLabel.Contains("+"))
                    {
                        lResult = lButtonLabel;
                    }
                }
                Dbg("用户忽略该消息框:结果:" + lResult);
                pLastDbgText = message;
            }
            return(lResult);
        }
Пример #2
0
        /// <summary>
        /// 创建一个自定义的消息盒
        /// 该方法主要是设置是否显示图标
        /// </summary>
        /// <returns></returns>
        private static CustomMsgBox CustomMsgBox()
        {
            CustomMsgBox lMsgBox = new CustomMsgBox();

            if (Logger.Icon == null)
            {
                lMsgBox.ShowIcon = false;
            }
            else
            {
                lMsgBox.Icon     = Logger.Icon;
                lMsgBox.ShowIcon = true;
            }
            return(lMsgBox);
        }
Пример #3
0
        /// <summary>
        /// 自定义消息对话框
        /// 可以设置设置Checkbox
        /// </summary>
        public static string MsgCustomCheckbox(string aMessage, string aTitle, string aRegistryCheckboxText, string aRegistryAppName, string aRegistrySection, string aRegistryKey, params string[] aButtonLabels)
        {
            Dbg("MsgCustom:" + aMessage + ":标题:" + aTitle + ":样式:" + string.Join(",", aButtonLabels));
            string lResult = "";

            string lRegistryLabel = null; //Interaction.GetSetting(aRegistryAppName, aRegistrySection, aRegistryKey, "");

            if (lRegistryLabel.Length > 0)
            {
                lResult = lRegistryLabel;
            }
            else if (pDisplayMessageBoxes)
            {
                CustomMsgBox lMsgBox = CustomMsgBox();
                lMsgBox.RegistryCheckboxText = aRegistryCheckboxText;
                lMsgBox.RegistryAppName      = aRegistryAppName;
                lMsgBox.RegistrySection      = aRegistrySection;
                lMsgBox.RegistryKey          = aRegistryKey;
                lResult = (string)(lMsgBox.AskUser(aMessage, aTitle, aButtonLabels));
                Dbg("消息对话框结果:" + lResult);
                pLastDbgText = "";
            }
            else
            {
                lResult = aButtonLabels[0];
                foreach (string lButtonLabel in aButtonLabels)
                {
                    if (lButtonLabel.Contains("+"))
                    {
                        lResult = lButtonLabel;
                    }
                }
                Dbg("用户忽略该消息框:结果:" + lResult);
                pLastDbgText = aMessage;
            }
            return(lResult);
        }