From 2450c12c825ad4d78d1572da2fa421706db2df2f Mon Sep 17 00:00:00 2001 From: 黄学彪 <hxb@hdlchina.com.cn> Date: 星期四, 18 六月 2020 16:01:14 +0800 Subject: [PATCH] 新代码 --- ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/UserCenterLogic.cs | 58 +++++++++++++++++++++++++++++++++++++--------------------- 1 files changed, 37 insertions(+), 21 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/UserCenterLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/UserCenterLogic.cs index 3d10478..a5f4373 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/UserCenterLogic.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/UserCenterLogic.cs @@ -95,6 +95,10 @@ } } var revertObj = JsonConvert.DeserializeObject<ResponsePack>(Encoding.UTF8.GetString(byteData)); + if (revertObj == null) + { + return "Error"; + } return revertObj.StateCode; } @@ -143,7 +147,7 @@ } if (revertObj == null || revertObj.ResponseData == null) { - return string.Empty; + return null; } return revertObj.ResponseData.ToString(); } @@ -423,9 +427,10 @@ int index = UserCenterResourse.listActionFormId.IndexOf(UserCenterResourse.NowActionFormID) - 1; //鍒濆鍊� UserCenterResourse.NowActionFormID = string.Empty; + var actionForm = UserView.HomePage.Instance.GetChildren(UserView.HomePage.Instance.ChildrenCount - 1); + if (index >= 0) { - var actionForm = UserView.HomePage.Instance.GetChildren(UserView.HomePage.Instance.ChildrenCount - 1); if (actionForm != null && actionForm is CommonFormBase) { string formId = ((CommonFormBase)actionForm).FormID; @@ -439,13 +444,15 @@ else if (actionForm != null && actionForm is UserView.UserPage) { //杩欓噷瀹冨凡缁忛��鍒颁富椤典簡 - if (UserCenterResourse.listActionFormId.Contains("UserMainForm") == true//涓汉涓績 - || UserCenterResourse.listActionFormId.Contains("HomeMainPageForm") == true)// - { - //璋冪敤鐣岄潰閲嶆柊婵�娲荤殑鍑芥暟 - CallFormActionAgainEvent(form, index); - } + var nowForm = UserView.UserPage.Instance.GetNowActionForm(); + nowForm?.FormActionAgainEvent(); } + } + else if (actionForm != null && actionForm is UserView.UserPage) + { + //杩欓噷瀹冨凡缁忛��鍒颁富椤典簡 + var nowForm = UserView.UserPage.Instance.GetNowActionForm(); + nowForm?.FormActionAgainEvent(); } } //绉婚櫎ID @@ -559,7 +566,7 @@ double Longitude = Config.Instance.Home.Longitude; double Latitude = Config.Instance.Home.Latitude; //杩樺師浣忓畢瀵硅薄 - Config.Instance.Home = House.GetHouseByHouseId(Config.Instance.Home.Id); + Config.Instance.Home = HdlResidenceLogic.Current.GetHouseByHouseId(Config.Instance.Home.Id); Config.Instance.Home.IsOthreShare = isOthreShare; Config.Instance.Home.AccountType = accountType; Config.Instance.Home.MainUserDistributedMark = mainMark; @@ -677,12 +684,12 @@ //娓呯┖褰撳墠浣忓畢id Config.Instance.HomeId = string.Empty; HdlGatewayLogic.Current.ClearAllRealGateway(); - try + + //鏂紑杩滅▼Mqtt杩炴帴 + HdlThreadLogic.Current.RunThread(async () => { - //鏂紑杩滅▼Mqtt杩炴帴 - ZigBee.Device.ZbGateway.DisConnectRemoteMqttClient(); - } - catch { } + await ZigBee.Device.ZbGateway.DisConnectRemoteMqttClient(); + }, ShowErrorMode.NO); HdlThreadLogic.Current.RunMain(() => { @@ -872,12 +879,11 @@ if (Common.Config.Instance.HomeId != UserCenterResourse.AccountOption.OldHomeStringId || Common.Config.Instance.Account != UserCenterResourse.AccountOption.OldAccountId) { - try + //鏂紑杩滅▼Mqtt杩炴帴 + HdlThreadLogic.Current.RunThread(async () => { - //鏂紑杩滅▼Mqtt杩炴帴 await ZigBee.Device.ZbGateway.DisConnectRemoteMqttClient(); - } - catch { } + }, ShowErrorMode.NO); //娓呯┖鎵�鏈夋垚鍛樼紦瀛� ClearAllMemberMemory(); @@ -929,7 +935,7 @@ //鍒濆鍖栨湰鍦扮殑缃戝叧淇℃伅 HdlGatewayLogic.Current.ReFreshByLocal(); //鍒濆鍖栨湰鍦扮殑璁惧淇℃伅 - Common.LocalDevice.Current.ReFreshByLocal(); + LocalDevice.Current.ReFreshByLocal(); //鍒濆鍖栨埧闂�(閮洩鍩庨偅杈逛笉鍋氬鐞�,闇�瑕佽繖閲岀壒娈婃墽琛屼竴姝�) HdlRoomLogic.Current.RefreshAllRoomByLocation(); @@ -1501,14 +1507,24 @@ #region 鈻� 鏂囦欢淇濆瓨鍜岃鍙朹____________________ /// <summary> - /// 鏂囦欢淇濆瓨,浠呴檺褰撳墠浣忓畢(鏁村ぉ蹇樿,鎵�浠ュ缓涓�涓嚱鏁版潵鐜╃帺) + /// 鏂囦欢淇濆瓨(鏁村ぉ蹇樿,鎵�浠ュ缓涓�涓嚱鏁版潵鐜╃帺) /// </summary> /// <param name="fullName">鍏ㄨ矾寰�</param> /// <param name="obj">闇�瑕佸簭鍒楀寲鐨勪笢瑗�</param> public static void SaveFileContent(string fullName, object obj) { var data = JsonConvert.SerializeObject(obj); - var byteData = Encoding.UTF8.GetBytes(data); + SaveTexToFile(fullName, data); + } + + /// <summary> + /// 鏂囦欢淇濆瓨(鏁村ぉ蹇樿,鎵�浠ュ缓涓�涓嚱鏁版潵鐜╃帺) + /// </summary> + /// <param name="fullName">鍏ㄨ矾寰�</param> + /// <param name="obj">闇�瑕佸簭鍒楀寲鐨勪笢瑗�</param> + public static void SaveTexToFile(string fullName, string textValue) + { + var byteData = Encoding.UTF8.GetBytes(textValue); //鍐欏叆鍐呭 System.IO.FileStream fileStream = null; try -- Gitblit v1.8.0