From 48ba446936b51fffafa7c3600c0dadc6ac0e8c20 Mon Sep 17 00:00:00 2001 From: 陈嘉乐 <cjl@hdlchina.com.cn> Date: 星期五, 10 七月 2020 10:52:13 +0800 Subject: [PATCH] 2020-07-10-01 --- ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlThreadLogic.cs | 46 ++++++++++++++++++++++++++-------------------- 1 files changed, 26 insertions(+), 20 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlThreadLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlThreadLogic.cs index 267595d..5b405df 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlThreadLogic.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlThreadLogic.cs @@ -36,7 +36,7 @@ /// <summary> /// 瀛愮嚎绋嬫墽琛�(鍒涘缓杩欎釜涓滆タ,鏄负浜哃og鍑哄姏) /// </summary> - public void RunThread(Action action) + public void RunThread(Action action, ShowErrorMode mode = ShowErrorMode.YES) { new System.Threading.Thread(() => { @@ -49,16 +49,18 @@ } catch (Exception ex) { - Application.RunOnMainThread(() => + if (mode == ShowErrorMode.YES) { - //鍑虹幇鏈煡閿欒,鏁版嵁涓㈠け - var alert = new ShowMsgControl(ShowMsgType.Error, Language.StringByID(R.MyInternationalizationString.uUnknownErrorAndDataLost)); - alert.Show(); - }); + Application.RunOnMainThread(() => + { + //鍑虹幇鏈煡閿欒,鏁版嵁涓㈠け + var alert = new ShowMsgControl(ShowMsgType.Error, Language.StringByID(R.MyInternationalizationString.uUnKnownError)); + alert.Show(); + }); + } //Log鍑哄姏 string msg = "褰撳墠婵�娲荤殑鐣岄潰[" + nowFormId + "]"; - HdlLogLogic.Current.WriteLog(-1, msg); - HdlLogLogic.Current.WriteLog(ex); + HdlLogLogic.Current.WriteLog(ex, msg); } }) { IsBackground = true }.Start(); @@ -67,7 +69,7 @@ /// <summary> /// 鎵ц杩愯瀛愮嚎绋嬮噷闈㈢殑涓荤嚎绋�(鍒涘缓杩欎釜涓滆タ,鏄负浜哃og鍑哄姏) /// </summary> - public void RunMainInThread(Action action) + public void RunMainInThread(Action action, ShowErrorMode mode = ShowErrorMode.YES) { new System.Threading.Thread(() => { @@ -82,13 +84,15 @@ } catch (Exception ex) { - //鍑虹幇鏈煡閿欒,鏁版嵁涓㈠け - var alert = new ShowMsgControl(ShowMsgType.Error, Language.StringByID(R.MyInternationalizationString.uUnknownErrorAndDataLost)); - alert.Show(); + if (mode == ShowErrorMode.YES) + { + //鍑虹幇鏈煡閿欒,鏁版嵁涓㈠け + var alert = new ShowMsgControl(ShowMsgType.Error, Language.StringByID(R.MyInternationalizationString.uUnKnownError)); + alert.Show(); + } //Log鍑哄姏 string msg = "褰撳墠婵�娲荤殑鐣岄潰[" + nowFormId + "]"; - HdlLogLogic.Current.WriteLog(-1, msg); - HdlLogLogic.Current.WriteLog(ex); + HdlLogLogic.Current.WriteLog(ex, msg); } }); @@ -99,7 +103,7 @@ /// <summary> /// 鎵ц杩愯浜庝富绾跨▼(鍒涘缓杩欎釜涓滆タ,鏄负浜哃og鍑哄姏) /// </summary> - public void RunMain(Action action) + public void RunMain(Action action, ShowErrorMode mode = ShowErrorMode.YES) { Application.RunOnMainThread(() => { @@ -112,14 +116,16 @@ } catch (Exception ex) { - //鍑虹幇鏈煡閿欒,鏁版嵁涓㈠け - var alert = new ShowMsgControl(ShowMsgType.Error, Language.StringByID(R.MyInternationalizationString.uUnknownErrorAndDataLost)); - alert.Show(); + if (mode == ShowErrorMode.YES) + { + //鍑虹幇鏈煡閿欒,鏁版嵁涓㈠け + var alert = new ShowMsgControl(ShowMsgType.Error, Language.StringByID(R.MyInternationalizationString.uUnKnownError)); + alert.Show(); + } //Log鍑哄姏 string msg = "褰撳墠婵�娲荤殑鐣岄潰[" + nowFormId + "]"; - HdlLogLogic.Current.WriteLog(-1, msg); - HdlLogLogic.Current.WriteLog(ex); + HdlLogLogic.Current.WriteLog(ex, msg); } }); } -- Gitblit v1.8.0