/// <summary> /// /// </summary> /// <param name="ex"></param> public static bool ProcessUnhandledException(Exception ex) { IExceptionProcess ep = ServiceProvider.GetService <IExceptionProcess>(); if (ep != null) { return(ep.ProcessUnhandledException(ex)); } else { return(DoDefaultExceptionProcess(ex)); } }
/// <summary> /// /// </summary> /// <param name="ex"></param> /// <returns></returns> public static bool ProcessWithNotify(Exception ex) { IExceptionProcess ep = ServiceProvider.GetService <IExceptionProcess>(); if (ep != null) { return(ep.ProcessWithNotify(ex)); } else { DoDefaultExceptionProcess(ex); return(true); } }
public static void TestAll() { SystemConfiguration.UseMultiThread = false; //if (MessageForm.ShowYesNo("Operate Data?")) { operateData = true; } m_stringExceptionProcess.Clear(); var instance = DefaultServiceProvider.Instance; IExceptionProcess defaultEp = null; IMessageBox defaultMb = null; if (instance != null) { defaultEp = ServiceProvider.GetService <IExceptionProcess>(); instance.SetDefaultService <IExceptionProcess>(m_stringExceptionProcess); defaultMb = ServiceProvider.GetService <IMessageBox>(); instance.SetDefaultService <IMessageBox>(m_emptyMessageBox); ServiceProvider.Clear(); } IList <MenuInfo> menuInfos = ADInfoBll.Instance.GetTopMenuInfos(); foreach (MenuInfo info in menuInfos) { TestMenu(info); } if (instance != null) { instance.SetDefaultService <IExceptionProcess>(defaultEp); instance.SetDefaultService <IMessageBox>(defaultMb); ServiceProvider.Clear(); } SystemConfiguration.UseMultiThread = true; ErrorReport errorReport = new ErrorReport("测试中的异常,请见详细内容。", "测试信息", MessageImage.Information, m_stringExceptionProcess.Exceptions); errorReport.ShowDialog(); }
/// <summary> /// /// </summary> /// <param name="ex"></param> /// <returns></returns> public static bool ProcessWithResume(Exception ex) { IExceptionProcess ep = ServiceProvider.GetService <IExceptionProcess>(); if (ep != null) { if (SystemConfiguration.IsInDebug) { ex.Data["Caption"] = "Debug版本异常,Release版本不显示。"; return(ep.ProcessWithNotify(ex)); } else { return(ep.ProcessWithResume(ex)); } } else { DoDefaultExceptionProcess(ex); return(true); } }