Ejemplo n.º 1
0
        /// <summary>
        /// 显示消息框
        /// </summary>
        /// <param name="messageBoxText">消息内容</param>
        /// <param name="caption">消息标题</param>
        /// <param name="button">消息框按钮</param>
        public static MessageBoxResult Show(string messageBoxText, string caption, MessageBoxButton button, Window Owner = null)
        {
            MessageBoxWindow window = null;

            Application.Current.Dispatcher.Invoke(new Action(() =>
            {
                window       = new MessageBoxWindow(messageBoxText, caption, button);
                window.Owner = Owner;
                window.ShowDialog();
            }));

            return(window.MessageBoxResult);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 显示消息框
        /// </summary>
        /// <param name="messageBoxText">消息内容</param>
        /// <returns></returns>
        public static MessageBoxResult ShowTip(string messageBoxText, Window Owner = null, int millisecond = 500)
        {
            MessageBoxWindow window = null;

            Application.Current.Dispatcher.Invoke(new Action(() =>
            {
                window       = new MessageBoxWindow(messageBoxText, millisecond);
                window.Owner = Owner;
                window.Show();
                window.Activate();
                window.Focus();
            }));

            return(window.MessageBoxResult);
        }