From 0d9f64668fd7350d6a21fd157e32009a96d98134 Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期三, 16 十二月 2020 13:09:08 +0800
Subject: [PATCH] 新云端代码Ver1.2

---
 ZigbeeApp/Shared/Phone/Common/Logic/HdlSafeguardLogic.cs |  125 +++++++++++++----------------------------
 1 files changed, 39 insertions(+), 86 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlSafeguardLogic.cs b/ZigbeeApp/Shared/Phone/Common/Logic/HdlSafeguardLogic.cs
similarity index 93%
rename from ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlSafeguardLogic.cs
rename to ZigbeeApp/Shared/Phone/Common/Logic/HdlSafeguardLogic.cs
index 68f332f..f10ab7e 100644
--- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlSafeguardLogic.cs
+++ b/ZigbeeApp/Shared/Phone/Common/Logic/HdlSafeguardLogic.cs
@@ -6,7 +6,7 @@
 using System.Threading.Tasks;
 using ZigBee.Device;
 
-namespace Shared.Phone.UserCenter
+namespace Shared.Phone
 {
     /// <summary>
     /// <para>瀹夐槻鏈湴缂撳瓨(浠g爜浣跨敤)</para>
@@ -107,7 +107,7 @@
                     var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
                     if (temp != null)
                     {
-                        string msg = HdlCheckLogic.Current.CheckCommonErrorCode(temp.Error);
+                        string msg = HdlCheckLogic.Current.CheckGatewayErrorCode(temp.Error);
                         if (msg != null)
                         {
                             this.ShowTipMsg(msg);
@@ -239,7 +239,7 @@
             //澶勭悊璁惧
             foreach (var data2 in allData.DeviceList)
             {
-                string mainKey = LocalDevice.Current.GetDeviceMainKeys(data2.MacAddr, data2.Epoint);
+                string mainKey = HdlDeviceCommonLogic.Current.GetDeviceMainKeys(data2.MacAddr, data2.Epoint);
                 //浼犳劅鍣ㄨ澶囦俊鎭�
                 var Deviceinfo = new Safeguard.ZoneDeviceListData();
                 Deviceinfo.IsBypass = data2.IsBypass;
@@ -250,7 +250,7 @@
                 zoneInfo.dicSensor[mainKey] = Deviceinfo;
 
                 //鏈湴鏄惁鏈夎繖涓澶�
-                CommonDevice device = LocalDevice.Current.GetDevice(mainKey);
+                CommonDevice device = HdlDeviceCommonLogic.Current.GetDevice(mainKey);
                 if (device != null)
                 {
                     //鍏ㄩ儴璁惧
@@ -297,10 +297,10 @@
                 if (data.Type == 0)
                 {
                     //鏈湴鏄惁鏈夎繖涓澶�
-                    string mainKey = LocalDevice.Current.GetDeviceMainKeys(data.DeviceAddr, data.Epoint);
+                    string mainKey = HdlDeviceCommonLogic.Current.GetDeviceMainKeys(data.DeviceAddr, data.Epoint);
                     //鎶ヨ淇℃伅
                     zoneInfo.dicAlarmDevice[mainKey] = data;
-                    CommonDevice device = LocalDevice.Current.GetDevice(mainKey);
+                    CommonDevice device = HdlDeviceCommonLogic.Current.GetDevice(mainKey);
                     if (device != null)
                     {
                         //鍏ㄩ儴璁惧
@@ -549,7 +549,7 @@
                 //鍚戦槻鍖烘坊鍔犺澶囧け璐�
                 string msg = Language.StringByID(R.MyInternationalizationString.uAddDeviceToZoneFail);
                 //鎷兼帴涓娿�愮綉鍏冲洖澶嶈秴鏃躲�戠殑Msg
-                msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, returnData);
+                msg = HdlCommonLogic.Current.CombineGatewayTimeOutMsg(msg, returnData);
 
                 this.ShowErrorMsg(msg);
                 return null;
@@ -561,20 +561,20 @@
                 //涓�鎵硅澶囬噷闈紝鎴愬姛娣诲姞鐨�
                 if (data.Status == 0)
                 {
-                    listSuccess.Add(LocalDevice.Current.GetDeviceMainKeys(data.MacAddr, data.Epoint));
+                    listSuccess.Add(HdlDeviceCommonLogic.Current.GetDeviceMainKeys(data.MacAddr, data.Epoint));
                 }
                 else if (data.Status == 1)
                 {
-                    var device = Common.LocalDevice.Current.GetDevice(data.MacAddr, data.Epoint);
-                    string msg = Common.LocalDevice.Current.GetDeviceEpointName(device) + "\r\n";
+                    var device = HdlDeviceCommonLogic.Current.GetDevice(data.MacAddr, data.Epoint);
+                    string msg = HdlDeviceCommonLogic.Current.GetDeviceEpointName(device) + "\r\n";
                     //鐩爣璁惧涓嶅瓨鍦�
                     msg += Language.StringByID(R.MyInternationalizationString.uTargetDeviceIsNotExsit);
                     this.ShowTipMsg(msg);
                 }
                 else if (data.Status == 2)
                 {
-                    var device = Common.LocalDevice.Current.GetDevice(data.MacAddr, data.Epoint);
-                    string msg = Common.LocalDevice.Current.GetDeviceEpointName(device) + "\r\n";
+                    var device = HdlDeviceCommonLogic.Current.GetDevice(data.MacAddr, data.Epoint);
+                    string msg = HdlDeviceCommonLogic.Current.GetDeviceEpointName(device) + "\r\n";
                     //璁惧宸插姞鍏ュ叾瀹冮槻鍖�
                     msg += Language.StringByID(R.MyInternationalizationString.uDeviceHadAddToTheOtherGarrison);
                     this.ShowTipMsg(msg);
@@ -735,7 +735,7 @@
                 //璁惧鍒犻櫎澶辫触
                 string msg = Language.StringByID(R.MyInternationalizationString.uDeviceDeleteFail);
                 //鎷兼帴涓娿�愮綉鍏冲洖澶嶈秴鏃躲�戠殑Msg
-                msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, returnData);
+                msg = HdlCommonLogic.Current.CombineGatewayTimeOutMsg(msg, returnData);
 
                 this.ShowErrorMsg(msg);
 
@@ -747,7 +747,7 @@
             {
                 if (data.Status == 0)
                 {
-                    listKeys.Add(LocalDevice.Current.GetDeviceMainKeys(data.MacAddr, data.Epoint));
+                    listKeys.Add(HdlDeviceCommonLogic.Current.GetDeviceMainKeys(data.MacAddr, data.Epoint));
                 }
             }
 
@@ -945,7 +945,7 @@
                 //鑾峰彇瀹夐槻瀵嗙爜澶辫触
                 string msg = Language.StringByID(R.MyInternationalizationString.uGetSafetyPasswordFail);
                 //鎷兼帴涓娿�愮綉鍏冲洖澶嶈秴鏃躲�戠殑Msg
-                msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, nowPw);
+                msg = HdlCommonLogic.Current.CombineGatewayTimeOutMsg(msg, nowPw);
 
                 if (mode == ShowErrorMode.YES)
                 {
@@ -975,7 +975,7 @@
                     //淇敼鐢ㄦ埛瀵嗙爜澶辫触
                     string msg = Language.StringByID(R.MyInternationalizationString.uChangedUserPasswordFail);
                     //鎷兼帴涓娿�愮綉鍏冲洖澶嶈秴鏃躲�戠殑Msg
-                    msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result);
+                    msg = HdlCommonLogic.Current.CombineGatewayTimeOutMsg(msg, result);
 
                     this.ShowErrorMsg(msg);
                     return false;
@@ -1076,7 +1076,7 @@
                 //淇敼澶囨敞淇℃伅澶辫触
                 string msg = Language.StringByID(R.MyInternationalizationString.uEditorNoteInformationFail);
                 //鎷兼帴涓娿�愮綉鍏冲洖澶嶈秴鏃躲�戠殑Msg
-                msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result);
+                msg = HdlCommonLogic.Current.CombineGatewayTimeOutMsg(msg, result);
 
                 this.ShowErrorMsg(msg);
                 return false;
@@ -1136,7 +1136,7 @@
                 //娣诲姞鎶ヨ鐩爣澶辫触
                 string msg = Language.StringByID(R.MyInternationalizationString.uAddAlarmTargetFail);
                 //鎷兼帴涓娿�愮綉鍏冲洖澶嶈秴鏃躲�戠殑Msg
-                msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result);
+                msg = HdlCommonLogic.Current.CombineGatewayTimeOutMsg(msg, result);
 
                 this.ShowErrorMsg(msg);
 
@@ -1148,8 +1148,8 @@
                 {
                     if (data.Type == "0")
                     {
-                        var device = Common.LocalDevice.Current.GetDevice(data.DeviceAddr, data.Epoint);
-                        string msg = Common.LocalDevice.Current.GetDeviceEpointName(device) + "\r\n";
+                        var device = HdlDeviceCommonLogic.Current.GetDevice(data.DeviceAddr, data.Epoint);
+                        string msg = HdlDeviceCommonLogic.Current.GetDeviceEpointName(device) + "\r\n";
                         //鐩爣璁惧涓嶅瓨鍦�
                         msg += Language.StringByID(R.MyInternationalizationString.uTargetDeviceIsNotExsit);
                         this.ShowTipMsg(msg);
@@ -1223,7 +1223,7 @@
                 //鍒犻櫎鎶ヨ鐩爣澶辫触
                 string msg = Language.StringByID(R.MyInternationalizationString.uDeleteAlarmTargetFail);
                 //鎷兼帴涓娿�愮綉鍏冲洖澶嶈秴鏃躲�戠殑Msg
-                msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result);
+                msg = HdlCommonLogic.Current.CombineGatewayTimeOutMsg(msg, result);
 
                 this.ShowErrorMsg(msg);
 
@@ -1249,7 +1249,7 @@
                 if (device.Type == "0")
                 {
                     //鍒犻櫎鎶ヨ璁惧
-                    string mainkeys = Common.LocalDevice.Current.GetDeviceMainKeys(device.DeviceAddr, device.Epoint);
+                    string mainkeys = HdlDeviceCommonLogic.Current.GetDeviceMainKeys(device.DeviceAddr, device.Epoint);
                     if (zoneInfo.dicAlarmDevice.ContainsKey(mainkeys) == false)
                     {
                         continue;
@@ -1336,7 +1336,7 @@
                 //鏃佽矾鐘舵�佽缃け璐�
                 string msg = Language.StringByID(R.MyInternationalizationString.uSetByPassStatuFail);
                 //鎷兼帴涓娿�愮綉鍏冲洖澶嶈秴鏃躲�戠殑Msg
-                msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result);
+                msg = HdlCommonLogic.Current.CombineGatewayTimeOutMsg(msg, result);
 
                 this.ShowErrorMsg(msg);
 
@@ -1368,7 +1368,7 @@
 
             if (this.UserPassword == null)
             {
-                var data = HdlFileLogic.Current.ReadFileByteContent(DirNameResourse.SafeguardUserPassword);
+                var data = HdlFileLogic.Current.ReadFileByteContent(HdlFileNameResourse.SafeguardUserPassword);
                 if (data != null)
                 {
                     this.UserPassword = System.Text.Encoding.UTF8.GetString(data);
@@ -1386,7 +1386,7 @@
                 if (result != GarrisonMode.None && result != GarrisonMode.RemoveGarrison)
                 {
                     //淇濆瓨鍔犲瘑鐨勫瘑鐮佸埌鏈湴
-                    HdlFileLogic.Current.SaveTextToFile(DirNameResourse.SafeguardUserPassword, this.UserPassword);
+                    HdlFileLogic.Current.SaveTextToFile(HdlFileNameResourse.SafeguardUserPassword, this.UserPassword);
                 }
                 return result;
             }
@@ -1436,7 +1436,7 @@
                 //甯冮槻璁剧疆澶辫触
                 string msg = Language.StringByID(R.MyInternationalizationString.uSetGarrisonFail);
                 //鎷兼帴涓娿�愮綉鍏冲洖澶嶈秴鏃躲�戠殑Msg
-                msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result);
+                msg = HdlCommonLogic.Current.CombineGatewayTimeOutMsg(msg, result);
 
                 this.ShowErrorMsg(msg);
                 return GarrisonMode.RemoveGarrison;
@@ -1475,7 +1475,7 @@
                     if (result2 != GarrisonMode.None && result2 != GarrisonMode.RemoveGarrison)
                     {
                         //淇濆瓨鍔犲瘑瀵嗙爜鍒版湰鍦�
-                        HdlFileLogic.Current.SaveTextToFile(DirNameResourse.SafeguardUserPassword, this.UserPassword);
+                        HdlFileLogic.Current.SaveTextToFile(HdlFileNameResourse.SafeguardUserPassword, this.UserPassword);
                     }
                     return result2;
                 }
@@ -1549,7 +1549,7 @@
                     //鎾ら槻澶辫触
                     string msg = Language.StringByID(R.MyInternationalizationString.uRemoveGarrisonFail);
                     //鎷兼帴涓娿�愮綉鍏冲洖澶嶈秴鏃躲�戠殑Msg
-                    msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result);
+                    msg = HdlCommonLogic.Current.CombineGatewayTimeOutMsg(msg, result);
 
                     this.ShowErrorMsg(msg);
                 }
@@ -1558,7 +1558,7 @@
                     //甯冮槻妯″紡鍙樻洿澶辫触
                     string msg = Language.StringByID(R.MyInternationalizationString.uChangedGarrisonModeFail);
                     //鎷兼帴涓娿�愮綉鍏冲洖澶嶈秴鏃躲�戠殑Msg
-                    msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result);
+                    msg = HdlCommonLogic.Current.CombineGatewayTimeOutMsg(msg, result);
 
                     this.ShowErrorMsg(msg);
                 }
@@ -1590,7 +1590,7 @@
                     if (result2 != -1)
                     {
                         //淇濆瓨鍒板姞瀵嗗瘑鐮佹湰鍦�
-                        HdlFileLogic.Current.SaveTextToFile(DirNameResourse.SafeguardUserPassword, this.UserPassword);
+                        HdlFileLogic.Current.SaveTextToFile(HdlFileNameResourse.SafeguardUserPassword, this.UserPassword);
                     }
                     return result2;
                 }
@@ -1717,7 +1717,7 @@
                 //璁剧疆淇℃伅鎺ㄩ�佸け璐�
                 string msg = Language.StringByID(R.MyInternationalizationString.uSetInformationPushFail);
                 //鎷兼帴涓娿�愮綉鍏冲洖澶嶈秴鏃躲�戠殑Msg
-                msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result);
+                msg = HdlCommonLogic.Current.CombineGatewayTimeOutMsg(msg, result);
 
                 this.ShowErrorMsg(msg);
                 return false;
@@ -1764,7 +1764,7 @@
                 //鑾峰彇寤舵椂鏃堕棿澶辫触
                 string msg = Language.StringByID(R.MyInternationalizationString.uGetDelayTimeFail);
                 //鎷兼帴涓娿�愮綉鍏冲洖澶嶈秴鏃躲�戠殑Msg
-                msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result);
+                msg = HdlCommonLogic.Current.CombineGatewayTimeOutMsg(msg, result);
 
                 this.ShowErrorMsg(msg);
                 return null;
@@ -1793,7 +1793,7 @@
                 //璁剧疆寤舵椂鏃堕棿澶辫触
                 string msg = Language.StringByID(R.MyInternationalizationString.uSetDelayTimeFail);
                 //鎷兼帴涓娿�愮綉鍏冲洖澶嶈秴鏃躲�戠殑Msg
-                msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result);
+                msg = HdlCommonLogic.Current.CombineGatewayTimeOutMsg(msg, result);
 
                 this.ShowErrorMsg(msg);
                 return false;
@@ -1818,7 +1818,7 @@
                 //鑾峰彇鑳佽揩鑱旂郴鏂瑰紡淇℃伅澶辫触
                 string msg = Language.StringByID(R.MyInternationalizationString.uGetCoercePhoneNumberFail);
                 //鎷兼帴涓娿�愮綉鍏冲洖澶嶈秴鏃躲�戠殑Msg
-                msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result);
+                msg = HdlCommonLogic.Current.CombineGatewayTimeOutMsg(msg, result);
 
                 this.ShowErrorMsg(msg);
                 return null;
@@ -1861,7 +1861,7 @@
                     //淇敼鑳佽揩鑱旂郴鏂瑰紡澶辫触
                     string msg = Language.StringByID(R.MyInternationalizationString.uChangedCoercePhoneNumberFail);
                     //鎷兼帴涓娿�愮綉鍏冲洖澶嶈秴鏃躲�戠殑Msg
-                    msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result);
+                    msg = HdlCommonLogic.Current.CombineGatewayTimeOutMsg(msg, result);
 
                     this.ShowErrorMsg(msg);
                     return false;
@@ -1875,7 +1875,7 @@
                     //淇敼澶囨敞淇℃伅澶辫触
                     string msg = Language.StringByID(R.MyInternationalizationString.uEditorNoteInformationFail);
                     //鎷兼帴涓娿�愮綉鍏冲洖澶嶈秴鏃躲�戠殑Msg
-                    msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, null, "鍥炲瓒呮椂");
+                    msg = HdlCommonLogic.Current.CombineGatewayTimeOutMsg(msg, null, "鍥炲瓒呮椂");
                     this.ShowErrorMsg(msg);
                     return false;
                 }
@@ -1922,7 +1922,7 @@
                 //鍒犻櫎鑳佽揩鑱旂郴鏂瑰紡澶辫触
                 string msg = Language.StringByID(R.MyInternationalizationString.uDeleteCoercePhoneNumberFail);
                 //鎷兼帴涓娿�愮綉鍏冲洖澶嶈秴鏃躲�戠殑Msg
-                msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result);
+                msg = HdlCommonLogic.Current.CombineGatewayTimeOutMsg(msg, result);
 
                 this.ShowErrorMsg(msg);
                 return false;
@@ -1973,7 +1973,7 @@
             //瑕佽�冭檻瀹冪殑鎺掑垪椤哄簭(鍙互鎸夐渶姹傚彉鏇寸紪鍙�)
             Dictionary<int, string> dicSort = new Dictionary<int, string>();
             //鏈�澶х紪鍙�
-            int MaxNo = listTaskInfo.Count > 4 ? listTaskInfo.Count : 4;
+            int MaxNo = 4;
             //寮�鍏崇殑浣嶇疆缂栧彿
             int ControlNo = 0;
             //鐧惧垎姣旂殑浣嶇疆缂栧彿
@@ -1984,45 +1984,9 @@
             int modelNo = 3;
             //绌鸿皟椋庨�熺殑浣嶇疆缂栧彿
             int windNo = 4;
-            //鍏朵粬缂栧彿(涓嶇悊浼氫綅缃�,浠ュ垪琛ㄧ殑椤哄簭涓哄噯)
-            int otherNo = 100;
 
             foreach (var info in listTaskInfo)
             {
-                #region 鈻� 鏅捐。鏋禵_____
-                //鈽呪槄鈽呪槄涓存椂澶勭悊,鍚庢湡浼氬垹闄�
-                if (info.Epoint != -1)
-                {
-                    //鏈�楂樻渶浣庡
-                    if (info.Epoint == 1)
-                    {
-                        dicSort[dicSort.Count + otherNo] = info.Data1 == 0 ? Language.StringByID(R.MyInternationalizationString.uTheHighestPoint) : Language.StringByID(R.MyInternationalizationString.uTheLowestPoint);
-                    }
-                    //椋庡共
-                    else if (info.Epoint == 3)
-                    {
-                        dicSort[dicSort.Count + otherNo] = info.Data1 == 1 ? Language.StringByID(R.MyInternationalizationString.uOpenAirdry) : Language.StringByID(R.MyInternationalizationString.uCloseAirdry);
-                    }
-                    //鐑樺共
-                    else if (info.Epoint == 4)
-                    {
-                        dicSort[dicSort.Count + otherNo] = info.Data1 == 1 ? Language.StringByID(R.MyInternationalizationString.uOpenDry) : Language.StringByID(R.MyInternationalizationString.uCloseDry);
-                    }
-                    //娑堟瘨
-                    else if (info.Epoint == 5)
-                    {
-                        dicSort[dicSort.Count + otherNo] = info.Data1 == 1 ? Language.StringByID(R.MyInternationalizationString.uOpenDisinfect) : Language.StringByID(R.MyInternationalizationString.uCloseDisinfect);
-                    }
-                    //鐓ф槑
-                    else if (info.Epoint == 2)
-                    {
-                        dicSort[dicSort.Count + otherNo] = info.Data1 == 1 ? Language.StringByID(R.MyInternationalizationString.uOpenLighting) : Language.StringByID(R.MyInternationalizationString.uCloseLighting);
-                    }
-                    //鐗规畩,涓嶈兘寰�涓嬭蛋
-                    continue;
-                }
-                #endregion
-
                 #region 鈻� 寮�鍏虫帶鍒禵___
                 //寮�鍏虫帶鍒�
                 if (info.TaskType == 1)
@@ -2154,17 +2118,6 @@
                 {
                     txtvalue += dicSort[i] + " ";
                 }
-            }
-            //鍏朵粬鐨�
-            MaxNo = otherNo + dicSort.Count;
-            for (int i = otherNo; i < MaxNo; i++)
-            {
-                if (dicSort.ContainsKey(i) == true)
-                {
-                    txtvalue += dicSort[i] + " ";
-                    continue;
-                }
-                break;
             }
 
             return txtvalue.Trim();
@@ -2348,7 +2301,7 @@
         /// <returns></returns>
         private string GetDeviceMainKeys(CommonDevice device)
         {
-            return Common.LocalDevice.Current.GetDeviceMainKeys(device);
+            return HdlDeviceCommonLogic.Current.GetDeviceMainKeys(device);
         }
 
         /// <summary>

--
Gitblit v1.8.0