From 9f326f4000847e6167d8166fa2f6a66f53cb3734 Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期四, 17 十二月 2020 09:07:13 +0800
Subject: [PATCH] 新云端Ver1.3

---
 ZigbeeApp/Shared/Phone/Common/Logic/HdlDeviceCurtainLogic.cs |   52 ++++++++++++++++++++++++++++++----------------------
 1 files changed, 30 insertions(+), 22 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceCurtainLogic.cs b/ZigbeeApp/Shared/Phone/Common/Logic/HdlDeviceCurtainLogic.cs
similarity index 89%
rename from ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceCurtainLogic.cs
rename to ZigbeeApp/Shared/Phone/Common/Logic/HdlDeviceCurtainLogic.cs
index bf9497a..643ef14 100644
--- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceCurtainLogic.cs
+++ b/ZigbeeApp/Shared/Phone/Common/Logic/HdlDeviceCurtainLogic.cs
@@ -1,13 +1,12 @@
 锘縰sing Newtonsoft.Json;
 using Newtonsoft.Json.Linq;
-using Shared.Phone.TemplateData;
 using System;
 using System.Collections.Generic;
 using System.Text;
 using System.Threading.Tasks;
 using ZigBee.Device;
 
-namespace Shared.Phone.UserCenter
+namespace Shared.Phone
 {
     /// <summary>
     /// 绐楀笜鐨勯�昏緫
@@ -51,7 +50,7 @@
             if (Common.Config.Instance.Home.IsVirtually == true)
             {
                 //娣诲姞缂撳瓨
-                TemplateDeviceDataLogic.Current.SetCurtainHandPullControl(device, bolStatu, null);
+                HdlTemplateDeviceDataLogic.Current.SetCurtainHandPullControl(device, bolStatu, null);
                 return true;
             }
             //鑾峰彇鍙戦�佺殑鍛戒护瀛楃
@@ -68,7 +67,7 @@
                 //鍒囨崲鎵嬫媺鎺у埗澶辫触
                 string msg = Language.StringByID(R.MyInternationalizationString.uChangeHandPullControlFail);
                 //鎷兼帴涓娿�愮綉鍏冲洖澶嶈秴鏃躲�戠殑Msg
-                msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result);
+                msg = HdlCommonLogic.Current.CombineGatewayTimeOutMsg(msg, result);
                 this.ShowTipMsg(msg);
                 return false;
             }
@@ -82,7 +81,7 @@
                 return false;
             }
             //娣诲姞缂撳瓨
-            TemplateDeviceDataLogic.Current.SetCurtainHandPullControl(device, bolStatu, result.JsonData[0]);
+            HdlTemplateDeviceDataLogic.Current.SetCurtainHandPullControl(device, bolStatu, result.JsonData[0]);
 
             return true;
         }
@@ -118,7 +117,7 @@
         {
             var result = this.SetCurtainDirectionAsync(rollershade, bolStatu);
             //妫�娴嬬綉鍏宠繑鍥炵殑鍏遍�氶敊璇姸鎬佺爜
-            string error = HdlCheckLogic.Current.CheckCommonErrorCode(result);
+            string error = HdlCheckLogic.Current.CheckGatewayErrorCode(result);
             if (error != null)
             {
                 this.ShowTipMsg(error);
@@ -129,7 +128,7 @@
                 //绐楀笜鏂瑰悜璁剧疆澶辫触
                 string msg = Language.StringByID(R.MyInternationalizationString.uSetCurtainDirectionFail);
                 //鎷兼帴涓娿�愮綉鍏冲洖澶嶈秴鏃躲�戠殑Msg
-                msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result);
+                msg = HdlCommonLogic.Current.CombineGatewayTimeOutMsg(msg, result);
                 this.ShowTipMsg(msg);
                 return false;
             }
@@ -153,7 +152,7 @@
             //濡傛灉褰撳墠鏄櫄鎷熶綇瀹�
             if (Common.Config.Instance.Home.IsVirtually == true)
             {
-                return TemplateDeviceDataLogic.Current.SetCurtainDirection(device, isDirectionReversed, null);
+                return HdlTemplateDeviceDataLogic.Current.SetCurtainDirection(device, isDirectionReversed, null);
             }
             //鑾峰彇缂栬緫绐楀笜鏂瑰悜鐨勫懡浠ゅ瓧绗�
             var sendData = this.GetCurtainDirectionCommadText(device.DeviceAddr, device.DeviceEpoint, isDirectionReversed);
@@ -164,7 +163,7 @@
             }
 
             //娣诲姞缂撳瓨
-            TemplateDeviceDataLogic.Current.SetCurtainDirection(device, isDirectionReversed, result.JsonData[0]);
+            HdlTemplateDeviceDataLogic.Current.SetCurtainDirection(device, isDirectionReversed, result.JsonData[0]);
 
             var tempData = JsonConvert.DeserializeObject<CommonDevice.SetWritableValueResponData>(result.ReceiptData);
             return new CommonDevice.SetWritableValueResponAllData { setWritableValueResponData = tempData };
@@ -205,7 +204,7 @@
             //濡傛灉褰撳墠鏄櫄鎷熶綇瀹�
             if (Common.Config.Instance.Home.IsVirtually == true)
             {
-                return TemplateData.TemplateDeviceDataLogic.Current.SetCurtainLimitPoint(rollershade, upLimit, downLimit, curtainLength, null);
+                return HdlTemplateDeviceDataLogic.Current.SetCurtainLimitPoint(rollershade, upLimit, downLimit, curtainLength, null);
             }
             //鑾峰彇缂栬緫寮�鍚堝笜闄愪綅鐨勫懡浠ゅ瓧绗�
             var sendData = this.GetAutoOpenCurtainLimitPointCommandText(rollershade.DeviceAddr, rollershade.DeviceEpoint, upLimit, downLimit);
@@ -215,7 +214,7 @@
                 //璁剧疆绐楀笜闄愪綅鐐瑰け璐�
                 string msg = Language.StringByID(R.MyInternationalizationString.uCommitCurtainLimitFail);
                 //鎷兼帴涓娿�愮綉鍏冲洖澶嶈秴鏃躲�戠殑Msg
-                msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result);
+                msg = HdlCommonLogic.Current.CombineGatewayTimeOutMsg(msg, result);
                 this.ShowTipMsg(msg);
                 return false;
             }
@@ -229,7 +228,7 @@
             }
 
             //娣诲姞缂撳瓨
-            TemplateDeviceDataLogic.Current.SetCurtainLimitPoint(rollershade, upLimit, downLimit, curtainLength, result.JsonData[0]);
+            HdlTemplateDeviceDataLogic.Current.SetCurtainLimitPoint(rollershade, upLimit, downLimit, curtainLength, result.JsonData[0]);
 
             return true;
         }
@@ -298,7 +297,7 @@
                 //result = await HdlDeviceAttributeLogic.Current.WriteDeviceAttribute(rollershade, 258, 24, 65, sendData);
             }
             //妫�娴嬬綉鍏宠繑鍥炵殑鍏遍�氶敊璇姸鎬佺爜
-            string error = HdlCheckLogic.Current.CheckCommonErrorCode(result);
+            string error = HdlCheckLogic.Current.CheckGatewayErrorCode(result);
             if (error != null)
             {
                 this.ShowTipMsg(error);
@@ -309,7 +308,7 @@
                 //璁剧疆绐楀笜闄愪綅鐐瑰け璐�
                 string msg = Language.StringByID(R.MyInternationalizationString.uCommitCurtainLimitFail);
                 //鎷兼帴涓娿�愮綉鍏冲洖澶嶈秴鏃躲�戠殑Msg
-                msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result);
+                msg = HdlCommonLogic.Current.CombineGatewayTimeOutMsg(msg, result);
                 this.ShowTipMsg(msg);
                 return false;
             }
@@ -334,7 +333,7 @@
         {
             var result = await rollershade.DeleteCurtainLimitsAsync(limiType);
             //妫�娴嬬綉鍏宠繑鍥炵殑鍏遍�氶敊璇姸鎬佺爜
-            string error = HdlCheckLogic.Current.CheckCommonErrorCode(result);
+            string error = HdlCheckLogic.Current.CheckGatewayErrorCode(result);
             if (error != null)
             {
                 this.ShowTipMsg(error);
@@ -345,7 +344,7 @@
                 //閲嶇疆绐楀笜闄愪綅鐐瑰け璐�
                 string msg = Language.StringByID(R.MyInternationalizationString.uDeleteCurtainLimitFail);
                 //鎷兼帴涓娿�愮綉鍏冲洖澶嶈秴鏃躲�戠殑Msg
-                msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result);
+                msg = HdlCommonLogic.Current.CombineGatewayTimeOutMsg(msg, result);
                 this.ShowTipMsg(msg);
                 return false;
             }
@@ -413,14 +412,17 @@
         /// </summary>
         /// <param name="rollershade">绐楀笜瀵硅薄</param>
         /// <returns></returns>
-        public async Task<bool> RestoreCurtain(Rollershade rollershade)
+        public async Task<bool> RestoreCurtain(Rollershade rollershade, ShowErrorMode showError = ShowErrorMode.YES)
         {
             var result = await rollershade.RestoreCurtainLimitAsync();
             //妫�娴嬬綉鍏宠繑鍥炵殑鍏遍�氶敊璇姸鎬佺爜
-            string error = HdlCheckLogic.Current.CheckCommonErrorCode(result);
+            string error = HdlCheckLogic.Current.CheckGatewayErrorCode(result);
             if (error != null)
             {
-                this.ShowTipMsg(error);
+                if (showError == ShowErrorMode.YES)
+                {
+                    this.ShowTipMsg(error);
+                }
                 return false;
             }
             if (result == null || result.setWritableValueResponData == null)
@@ -428,15 +430,21 @@
                 //閲嶇疆绐楀笜澶辫触
                 string msg = Language.StringByID(R.MyInternationalizationString.uRestoreCurtainFail);
                 //鎷兼帴涓娿�愮綉鍏冲洖澶嶈秴鏃躲�戠殑Msg
-                msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result);
-                this.ShowTipMsg(msg);
+                msg = HdlCommonLogic.Current.CombineGatewayTimeOutMsg(msg, result);
+                if (showError == ShowErrorMode.YES)
+                {
+                    this.ShowTipMsg(msg);
+                }
                 return false;
             }
             if (result.setWritableValueResponData.Status != 0)
             {
                 //閲嶇疆绐楀笜澶辫触
                 string msg = Language.StringByID(R.MyInternationalizationString.uRestoreCurtainFail);
-                this.ShowTipMsg(msg);
+                if (showError == ShowErrorMode.YES)
+                {
+                    this.ShowTipMsg(msg);
+                }
                 return false;
             }
             return true;

--
Gitblit v1.8.0