From e90209beae6a4e822cecb18e6889f8bda23f630e Mon Sep 17 00:00:00 2001 From: 黄学彪 <hxb@hdlchina.com.cn> Date: 星期一, 14 十二月 2020 11:16:06 +0800 Subject: [PATCH] 合并了晾衣架(非新云端) --- ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceBindLogic.cs | 86 +++++++++++++++++++++++++++++-------------- 1 files changed, 58 insertions(+), 28 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/Common/Logic/HdlDeviceBindLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceBindLogic.cs similarity index 91% rename from ZigbeeApp/Shared/Phone/Common/Logic/HdlDeviceBindLogic.cs rename to ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceBindLogic.cs index 048b08c..30cbe5b 100644 --- a/ZigbeeApp/Shared/Phone/Common/Logic/HdlDeviceBindLogic.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceBindLogic.cs @@ -5,7 +5,7 @@ using System.Threading.Tasks; using Newtonsoft.Json.Linq; -namespace Shared.Phone +namespace Shared.Phone.UserCenter { /// <summary> /// 璁惧缁戝畾鐨勯�昏緫 @@ -50,15 +50,15 @@ //鑾峰彇璁惧鐨勭粦瀹氱洰鏍囧け璐� string msg = Language.StringByID(R.MyInternationalizationString.uGetDeviceBindTargetFail); //鎷兼帴涓娿�愮綉鍏冲洖澶嶈秴鏃躲�戠殑Msg - msg = HdlCommonLogic.Current.CombineGatewayTimeOutMsg(msg, result); + msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result); - HdlMessageLogic.Current.ShowMassage(ShowMsgType.Error, msg); + this.ShowErrorMsg(msg); return null; } var listDevice = new List<CommonDevice>(); foreach (var data in result.getAllBindResponseData.BindList) { - CommonDevice deviceTemp = HdlDeviceCommonLogic.Current.GetDevice(data.BindMacAddr, data.BindEpoint); + CommonDevice deviceTemp = Common.LocalDevice.Current.GetDevice(data.BindMacAddr, data.BindEpoint); if (deviceTemp == null) { continue; @@ -134,7 +134,7 @@ addData.BindList.Add(info); //杩斿洖鎴愬姛璁惧鐨勬椂鍊欎娇鐢� - string mainkeys = HdlDeviceCommonLogic.Current.GetDeviceMainKeys(device); + string mainkeys = Common.LocalDevice.Current.GetDeviceMainKeys(device); dicDevice[mainkeys] = device; } //鎵ц缁戝畾 @@ -144,16 +144,16 @@ //缁戝畾鐩爣璁剧疆澶辫触 string msg = Language.StringByID(R.MyInternationalizationString.uSetBindTargetsFail); //鎷兼帴涓娿�愮綉鍏冲洖澶嶈秴鏃躲�戠殑Msg - msg = HdlCommonLogic.Current.CombineGatewayTimeOutMsg(msg, result); + msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result); - HdlMessageLogic.Current.ShowMassage(ShowMsgType.Error, msg); + this.ShowErrorMsg(msg); return null; } var listSuccess = new List<CommonDevice>(); foreach (var data in result.addedDeviceBindResponseData.BindList) { - string mainkeys = HdlDeviceCommonLogic.Current.GetDeviceMainKeys(data.BindMacAddr, data.BindEpoint); + string mainkeys = Common.LocalDevice.Current.GetDeviceMainKeys(data.BindMacAddr, data.BindEpoint); if (dicDevice.ContainsKey(mainkeys) == true) { listSuccess.Add(dicDevice[mainkeys]); @@ -164,7 +164,7 @@ { //缁戝畾鐩爣璁剧疆澶辫触 string msg = Language.StringByID(R.MyInternationalizationString.uSetBindTargetsFail); - HdlMessageLogic.Current.ShowMassage(ShowMsgType.Tip, msg); + this.ShowTipMsg(msg); } return listSuccess; } @@ -180,7 +180,7 @@ return TemplateData.TemplateDeviceDataLogic.Current.AddDeviceBindList(addBindData, null); } - var device = HdlDeviceCommonLogic.Current.GetDevice(addBindData.DeviceAddr, addBindData.Epoint); + var device = Common.LocalDevice.Current.GetDevice(addBindData.DeviceAddr, addBindData.Epoint); //鑾峰彇鍙戦�佺殑鍛戒护瀛楃 var sendData = this.GetAddDeviceListBindCommandText(addBindData); //鍙戦�� @@ -230,7 +230,7 @@ /// </summary> public BindObj.AddedDeviceSingleBindResponseAllData AddDeviceSingleBindAsync(BindObj.AddSingleBindData addSingleBindData) { - var device = HdlDeviceCommonLogic.Current.GetDevice(addSingleBindData.DeviceAddr, addSingleBindData.Epoint); + var device = Common.LocalDevice.Current.GetDevice(addSingleBindData.DeviceAddr, addSingleBindData.Epoint); //鑾峰彇鍙戦�佺殑鍛戒护瀛楃 var sendData = this.GetAddDeviceListSingleBindCommandText(addSingleBindData); //鍙戦�� @@ -305,9 +305,9 @@ //鍒犻櫎缁戝畾鐩爣澶辫触 string msg = Language.StringByID(R.MyInternationalizationString.uDeleteBindTargetsFail); //鎷兼帴涓娿�愮綉鍏冲洖澶嶈秴鏃躲�戠殑Msg - msg = HdlCommonLogic.Current.CombineGatewayTimeOutMsg(msg, result); + msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result); - HdlMessageLogic.Current.ShowMassage(ShowMsgType.Error, msg); + this.ShowErrorMsg(msg); return false; } @@ -323,7 +323,7 @@ { //鍏朵粬缁戝畾鐩爣姝e湪鍒犻櫎涓紝璇风◢鍚庡啀璇� string msg = Language.StringByID(R.MyInternationalizationString.uOtherBindTargetsIsDelettingPleaseWait); - HdlMessageLogic.Current.ShowMassage(ShowMsgType.Error, msg); + this.ShowErrorMsg(msg); return false; } //2锛氭湭鐭ワ紝鐢辫妭鐐硅澶囧弽棣堝彂閫佲�淏ind/BindResult鈥濅富棰樻秷鎭‘瀹氭槸鍚︽垚鍔� @@ -333,7 +333,7 @@ { //鍒犻櫎缁戝畾鐩爣澶辫触 string msg = Language.StringByID(R.MyInternationalizationString.uDeleteBindTargetsFail); - HdlMessageLogic.Current.ShowMassage(ShowMsgType.Error, msg); + this.ShowErrorMsg(msg); return false; } else @@ -353,7 +353,7 @@ { //鍒犻櫎缁戝畾鐩爣澶辫触 string msg = Language.StringByID(R.MyInternationalizationString.uDeleteBindTargetsFail); - HdlMessageLogic.Current.ShowMassage(ShowMsgType.Error, msg); + this.ShowErrorMsg(msg); return false; } } @@ -387,7 +387,7 @@ deleteData.RemoveBindList.Add(info); //杩斿洖鎴愬姛璁惧鐨勬椂鍊欎娇鐢� - string mainkeys = HdlDeviceCommonLogic.Current.GetDeviceMainKeys(device); + string mainkeys = Common.LocalDevice.Current.GetDeviceMainKeys(device); dicDevice[mainkeys] = device; } var listSuccess = new List<CommonDevice>(); @@ -398,15 +398,15 @@ //鍒犻櫎缁戝畾鐩爣澶辫触 string msg = Language.StringByID(R.MyInternationalizationString.uDeleteBindTargetsFail); //鎷兼帴涓娿�愮綉鍏冲洖澶嶈秴鏃躲�戠殑Msg - msg = HdlCommonLogic.Current.CombineGatewayTimeOutMsg(msg, result); + msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result); - HdlMessageLogic.Current.ShowMassage(ShowMsgType.Error, msg); + this.ShowErrorMsg(msg); return listSuccess; } foreach (var data in result.delDeviceBindResponseData.RemoveBindList) { - string mainkeys = HdlDeviceCommonLogic.Current.GetDeviceMainKeys(data.BindMacAddr, data.BindEpoint); + string mainkeys = Common.LocalDevice.Current.GetDeviceMainKeys(data.BindMacAddr, data.BindEpoint); //0:鎴愬姛 1:璁惧涓嶅湪缁戝畾鍒楄〃涓� 锛屼篃鍙互浠h〃鎴愬姛 if (data.Result == 0 || data.Result == 1) { @@ -416,9 +416,9 @@ else if (data.Result == 3) { //璁惧鍚嶇О 鍏朵粬缁戝畾鐩爣姝e湪鍒犻櫎涓紝璇风◢鍚庡啀璇� - string msg = HdlDeviceCommonLogic.Current.GetDeviceEpointName(dicDevice[mainkeys]) + "\r\n"; + string msg = Common.LocalDevice.Current.GetDeviceEpointName(dicDevice[mainkeys]) + "\r\n"; msg += Language.StringByID(R.MyInternationalizationString.uOtherBindTargetsIsDelettingPleaseWait); - HdlMessageLogic.Current.ShowMassage(ShowMsgType.Error, msg); + this.ShowErrorMsg(msg); } //2锛氭湭鐭ワ紝鐢辫妭鐐硅澶囧弽棣堝彂閫佲�淏ind/BindResult鈥濅富棰樻秷鎭‘瀹氭槸鍚︽垚鍔� else if (data.Result == 2) @@ -426,9 +426,9 @@ if (result.removeBindResultResponseData == null) { //璁惧鍚嶇О 鍒犻櫎缁戝畾鐩爣澶辫触 - string msg = HdlDeviceCommonLogic.Current.GetDeviceEpointName(dicDevice[mainkeys]) + "\r\n"; + string msg = Common.LocalDevice.Current.GetDeviceEpointName(dicDevice[mainkeys]) + "\r\n"; msg += Language.StringByID(R.MyInternationalizationString.uDeleteBindTargetsFail); - HdlMessageLogic.Current.ShowMassage(ShowMsgType.Error, msg); + this.ShowErrorMsg(msg); } else { @@ -446,9 +446,9 @@ else { //璁惧鍚嶇О 鍒犻櫎缁戝畾鐩爣澶辫触 - string msg = HdlDeviceCommonLogic.Current.GetDeviceEpointName(dicDevice[mainkeys]) + "\r\n"; + string msg = Common.LocalDevice.Current.GetDeviceEpointName(dicDevice[mainkeys]) + "\r\n"; msg += Language.StringByID(R.MyInternationalizationString.uDeleteBindTargetsFail); - HdlMessageLogic.Current.ShowMassage(ShowMsgType.Error, msg); + this.ShowErrorMsg(msg); } } } @@ -468,7 +468,7 @@ { return TemplateData.TemplateDeviceDataLogic.Current.DeleteDeviceBindList(delDeviceBindData); } - var device = HdlDeviceCommonLogic.Current.GetDevice(delDeviceBindData.DeviceAddr, delDeviceBindData.Epoint); + var device = Common.LocalDevice.Current.GetDevice(delDeviceBindData.DeviceAddr, delDeviceBindData.Epoint); //鑾峰彇闇�瑕佸彂閫佺殑鏁版嵁 var sendData = this.GetDeleteDeviceBindCommandText(delDeviceBindData); //鍙戦�佸懡浠� @@ -600,7 +600,7 @@ if (topic == errorTopic) { var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString()); - reResult.ErrorMsg = HdlCheckLogic.Current.CheckGatewayErrorCode(temp.Error); + reResult.ErrorMsg = HdlCheckLogic.Current.CheckCommonErrorCode(temp.Error); } //濡傛灉鏄寚瀹氱殑涓婚 for (int i = 0; i < listReceiptTopic.Count; i++) @@ -769,5 +769,35 @@ } #endregion + + #region 鈻� 涓�鑸柟娉昣__________________________ + + /// <summary> + /// 鏄剧ず閿欒淇℃伅绐楀彛 + /// </summary> + /// <param name="msg"></param> + private void ShowErrorMsg(string msg) + { + Application.RunOnMainThread(() => + { + var contr = new ShowMsgControl(ShowMsgType.Error, msg); + contr.Show(); + }); + } + + /// <summary> + /// 鏄剧ずTip淇℃伅绐楀彛 + /// </summary> + /// <param name="msg"></param> + private void ShowTipMsg(string msg) + { + Application.RunOnMainThread(() => + { + var contr = new UserCenter.ShowMsgControl(ShowMsgType.Tip, msg); + contr.Show(); + }); + } + + #endregion } } -- Gitblit v1.8.0