Exemplo n.º 1
0
        /// <summary>
        /// 弹出安全提示
        /// </summary>
        private int SecurityAlert_Event(IntPtr text)
        {
            int ret = -1;

            MessageDialog.ButtnClick buttnClick = (type) =>
            {
                ret = type;
                if (ret == MessageDialog.IDCANCEL)
                {
                    Dispatcher.Invoke(() => { Closed?.Invoke(); });
                }
            };

            Dispatcher.Invoke(() =>
            {
                MessageDialog.Show(ParentControl, "安全警告", Marshal.PtrToStringAnsi(text), MessageDialog.MB_YESNOCANCEL,
                                   buttnClick, MessageDialog.IDCANCEL, 60);
            });

            while (true)
            {
                Thread.Sleep(15);
                if (ret >= 0)
                {
                    break;
                }
            }

            return(ret);
        }
Exemplo n.º 2
0
 /// <summary>
 /// 远程桌面发生致命错误
 /// </summary>
 private void OnFatalError(string title, string errorText)
 {
     if (_remoteControl != null)
     {
         _remoteControl.Visibility = Visibility.Collapsed;
     }
     MessageDialog.ButtnClick Button_Ok_Click = (btnType) =>
     {
         Close();
     };
     if (_fullScreen)
     {
         MessageDialog.Show(_fullScreenWindow, title, errorText, MessageDialog.MB_OK, Button_Ok_Click);
     }
     else
     {
         if (ActualHeight < 1)
         {
             UpdateLayout();                  //防止弹出报错的时候,控件还没有正常在界面显示
         }
         MessageDialog.Show(this, title, errorText, MessageDialog.MB_OK, Button_Ok_Click);
     }
 }