黄学彪
2019-10-12 c6b35c3138b944830b5336bf610f918154dd47c7
ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlThreadLogic.cs
@@ -56,10 +56,9 @@
                        alert.Show();
                    });
                    //Log出力
                    string msg = "当前激活的界面[" + nowFormId + "]\r\n";
                    msg += ex.Message + "\r\n";
                    msg += ex.TargetSite.ToString();
                    string msg = "当前激活的界面[" + nowFormId + "]";
                    HdlLogLogic.Current.WriteLog(-1, msg);
                    HdlLogLogic.Current.WriteLog(ex);
                }
            })
            { IsBackground = true }.Start();
@@ -87,10 +86,9 @@
                        var alert = new ShowMsgControl(ShowMsgType.Error, Language.StringByID(R.MyInternationalizationString.uUnknownErrorAndDataLost));
                        alert.Show();
                        //Log出力
                        string msg = "当前激活的界面[" + nowFormId + "]\r\n";
                        msg += ex.Message + "\r\n";
                        msg += ex.TargetSite.ToString();
                        string msg = "当前激活的界面[" + nowFormId + "]";
                        HdlLogLogic.Current.WriteLog(-1, msg);
                        HdlLogLogic.Current.WriteLog(ex);
                    }
                });
                
@@ -98,6 +96,34 @@
            { IsBackground = true }.Start();
        }
        /// <summary>
        /// 执行运行于主线程(创建这个东西,是为了Log出力)
        /// </summary>
        public void RunMain(Action action)
        {
            Application.RunOnMainThread(() =>
            {
                //记录起当前界面,虽然似乎没啥用
                string nowFormId = UserCenterResourse.NowActionFormID;
                try
                {
                    action.Invoke();
                    action = null;
                }
                catch (Exception ex)
                {
                    //出现未知错误,数据丢失
                    var alert = new ShowMsgControl(ShowMsgType.Error, Language.StringByID(R.MyInternationalizationString.uUnknownErrorAndDataLost));
                    alert.Show();
                    //Log出力
                    string msg = "当前激活的界面[" + nowFormId + "]";
                    HdlLogLogic.Current.WriteLog(-1, msg);
                    HdlLogLogic.Current.WriteLog(ex);
                }
            });
        }
        #endregion
    }
}