void Current_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e) { var a = e.Exception is ApplicationException; e.Handled = true; LoggerManagerSingle.Instance.Error(e.Exception); _msgBox.ShowDialogErrorMsg("程序出现严重错误,即将关闭"); Application.Current.Shutdown(); }
public bool ShowDialogErrorMsg(string errorText) { if (_msgBox != null) { bool ret = false; SystemContext.Instance.AsyncOperation.SynchronizationContext.Post( state => { ret = _msgBox.ShowDialogErrorMsg(errorText); }, null); return(ret); } else { MessageBoxResult result = MessageBox.Show(errorText, "提示"); return(result == MessageBoxResult.OK); } }