예제 #1
0
        /// <summary>
        /// 显示询问的对话框
        /// Yes No Cancel三个按钮
        /// </summary>
        /// <param name="text"></param>
        /// <param name="caption"></param>
        /// <returns></returns>
        public static WPFMessageBoxResult ShowQuestion(string text, string caption)
        {
            string       gridName = "grid" + CBaseData.NewGuid();
            DialogResult result   = DialogResult.Cancel;

            Application.Current.Dispatcher.Invoke(new Action(() =>
            {
                if (CBaseData.bWPFEffect)
                {
                    GrayContent.AddGrayContent(CBaseData.MainWindow, gridName);
                }

                result =
                    MessageBox.Show(text, caption, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);


                if (CBaseData.bWPFEffect)
                {
                    GrayContent.RemoveGrayContent(CBaseData.MainWindow, gridName);
                }
            }));
            return(result == DialogResult.Yes ? WPFMessageBoxResult.Yes :
                   result == DialogResult.No ? WPFMessageBoxResult.No :
                   WPFMessageBoxResult.Cancel);
        }
예제 #2
0
        /// <summary>
        /// 显示警告提示框
        /// 输入信息检验失败
        /// </summary>
        /// <param name="text"></param>
        /// <param name="caption"></param>
        public static void ShowWarring(string text, string caption)
        {
            string gridName = "grid" + CBaseData.NewGuid();

            Application.Current.Dispatcher.Invoke(new Action(() =>
            {
                if (CBaseData.bWPFEffect)
                {
                    GrayContent.AddGrayContent(CBaseData.MainWindow, gridName);
                }

                MessageBox.Show(text, caption, MessageBoxButtons.OK, MessageBoxIcon.Warning);

                if (CBaseData.bWPFEffect)
                {
                    GrayContent.RemoveGrayContent(CBaseData.MainWindow, gridName);
                }
            }));
        }
예제 #3
0
        public static WPFMessageBoxResult Show(string text, string caption, MessageBoxButtons button,
                                               MessageBoxIcon icon = MessageBoxIcon.Information)
        {
            string gridName = "grid" + CBaseData.NewGuid();

            if (CBaseData.bWPFEffect)
            {
                GrayContent.AddGrayContent(CBaseData.MainWindow, gridName);
            }

            DialogResult result = MessageBox.Show(text, caption, button, icon);


            if (CBaseData.bWPFEffect)
            {
                GrayContent.RemoveGrayContent(CBaseData.MainWindow, gridName);
            }

            return((result == DialogResult.Yes) ? WPFMessageBoxResult.Yes :
                   (result == DialogResult.No) ? WPFMessageBoxResult.No :
                   (result == DialogResult.OK) ? WPFMessageBoxResult.OK :
                   WPFMessageBoxResult.Cancel);
        }