//處理UI執行緒錯誤 static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e) { string msg; Exception err = e.Exception as Exception; if (err != null) { if (err.Message.Contains("無法存取伺服器")) { msg = "網路連線失敗,請離開目前作業重新操作\n"; } else if (err.Message.Contains("逾時")) { msg = "網路連線逾時"; } else if (err.Message.Contains("信號交換")) { msg = "網路連線逾時"; } else { msg = "發生應用程式例外,請離開目前作業重新操作\n並聯絡資訊部車機處理人員\n"; } } else { msg = "發生應用程式例外,請離開目前作業重新操作\n並聯絡資訊部車機處理人員\n"; } WhenException_Then_SnapShot(); RecLog reclog = new RecLog(); reclog.ExLog(err, "01"); fMsg.messageshow(msg); }
//非處理UI執行緒錯誤 static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) { string msg; Exception err = e.ExceptionObject as Exception; if (err != null) { if (err.Message.Contains("無法存取伺服器")) { msg = "網路連線失敗,請離開目前作業重新操作\n"; } else if (err.Message.Contains("逾時")) { msg = "網路連線逾時"; } else if (err.Message.Contains("信號交換")) { msg = "網路連線逾時"; } else { msg = "發生應用程式例外,請離開目前作業重新操作\n並聯絡資訊部車機處理人員\n"; } } else { msg = string.Format("Application UnhandleException,請離開目前作業重新操作\n並聯絡資訊部車機處理人員:{0}", e); } WhenException_Then_SnapShot(); RecLog reclog = new RecLog(); reclog.ExLog(err, "02"); fMsg.messageshow(msg); }
public void AddTextRec(int N, string zonename, string pathname, float x, float y) { Dispatcher.BeginInvoke(new Action( () => RecLog.AppendText(string.Format("{0} Zone: {1} Path: {2} X: {3} Y: {4}\u2028", N, zonename, pathname, x, y)))); }