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/UserCenter/Device/AirConditioner/IndoorUnitSettionForm.cs |   90 ++++++++++++++++++++++++++++----------------
 1 files changed, 57 insertions(+), 33 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/AirConditioner/IndoorUnitSettionForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/AirConditioner/IndoorUnitSettionForm.cs
index 8c174d1..bded1c4 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/Device/AirConditioner/IndoorUnitSettionForm.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/AirConditioner/IndoorUnitSettionForm.cs
@@ -95,37 +95,43 @@
 
             //璁惧澶囨敞
             string caption = Language.StringByID(R.MyInternationalizationString.uDeviceNote);
-            string nameValue = Common.LocalDevice.Current.GetDeviceEpointName(deviceAc);
+            string nameValue = HdlDeviceCommonLogic.Current.GetDeviceEpointName(deviceAc);
             var btnNote = new FrameCaptionInputControl(caption, nameValue, listview.rowSpace / 2);
+            btnNote.txtInput.MaxByte = 48;//闄愬埗鍙兘杈撳叆48涓瓧鑺�
             listview.AddChidren(btnNote);
             btnNote.InitControl();
             //鍒掔嚎
             btnNote.AddBottomLine();
-            btnNote.txtInput.FinishInputEvent += async () =>
-             {
-                 string oldName = Common.LocalDevice.Current.GetDeviceEpointName(deviceAc);
-                 if (btnNote.Text.Trim() == string.Empty)
-                 {
-                     //灏嗗悕瀛楄繕鍘�
-                     btnNote.Text = oldName;
-                 }
-                 if (oldName != btnNote.Text)
-                 {
-                     //璁惧鍚嶇О淇敼
-                     var result = await Common.LocalDevice.Current.ReName(deviceAc, btnNote.Text);
-                     if (result == false)
-                     {
-                         return;
-                     }
-                     //璁惧澶囨敞淇敼鎴愬姛!
-                     string msg = Language.StringByID(R.MyInternationalizationString.uDeviceReNoteSuccess);
-                     this.ShowMassage(ShowMsgType.Tip, msg);
-                 }
-             };
+            btnNote.txtInput.FinishInputEvent += () =>
+            {
+                string oldName = HdlDeviceCommonLogic.Current.GetDeviceEpointName(deviceAc);
+                if (btnNote.Text.Trim() == string.Empty)
+                {
+                    //灏嗗悕瀛楄繕鍘�
+                    btnNote.Text = oldName;
+                }
+                if (oldName != btnNote.Text)
+                {
+                    //鏌ョ湅妯℃澘鏃�,涓嶅厑璁哥紪杈�
+                    if (Common.Config.Instance.Home.IsShowTemplate == true)
+                    {
+                        return;
+                    }
+                    //璁惧鍚嶇О淇敼
+                    var result = HdlDeviceCommonLogic.Current.ReName(deviceAc, btnNote.Text);
+                    if (result == false)
+                    {
+                        return;
+                    }
+                    //璁惧澶囨敞淇敼鎴愬姛!
+                    string msg = Language.StringByID(R.MyInternationalizationString.uDeviceReNoteSuccess);
+                    this.ShowMassage(ShowMsgType.Tip, msg);
+                }
+            };
 
             //璁惧绫诲瀷
             caption = Language.StringByID(R.MyInternationalizationString.uDeviceType);
-            nameValue = Common.LocalDevice.Current.GetDeviceObjectText(new List<CommonDevice>() { deviceAc });
+            nameValue = HdlDeviceCommonLogic.Current.GetDeviceObjectText(new List<CommonDevice>() { deviceAc });
             var btnType = new FrameCaptionViewControl(caption, nameValue, listview.rowSpace / 2);
             btnType.UseClickStatu = false;
             listview.AddChidren(btnType);
@@ -174,9 +180,9 @@
                 string statu = btnSwingSwitch.IsSelected == true ? "0" : "1";
                 //灏嗕簩杩涘埗杞崲涓哄崄杩涘埗
                 int sendData = Convert.ToInt32(this.fixValue + statu, 2);
-                HdlThreadLogic.Current.RunThread(async () =>
+                HdlThreadLogic.Current.RunThread(() =>
                 {
-                    var result = await HdlDeviceAirConditionerLogic.Current.SetUseAcSwingFunctionStatu(deviceAc, sendData);
+                    var result = HdlDeviceAirConditionerLogic.Current.SetUseAcSwingFunctionStatu(deviceAc, sendData);
                     if (result == true)
                     {
                         HdlThreadLogic.Current.RunMain(() =>
@@ -201,13 +207,13 @@
             var btnFinish = new BottomClickButton();
             btnFinish.TextID = R.MyInternationalizationString.uSave;
             bodyFrameLayout.AddChidren(btnFinish);
-            btnFinish.ButtonClickEvent += async (sender, e) =>
+            btnFinish.ButtonClickEvent += (sender, e) =>
             {
-                string oldName = Common.LocalDevice.Current.GetDeviceEpointName(deviceAc);
+                string oldName = HdlDeviceCommonLogic.Current.GetDeviceEpointName(deviceAc);
                 if (oldName != btnNote.Text)
                 {
                     //璁惧鍚嶇О淇敼
-                    var result = await Common.LocalDevice.Current.ReName(deviceAc, btnNote.Text);
+                    var result = HdlDeviceCommonLogic.Current.ReName(deviceAc, btnNote.Text);
                     if (result == false)
                     {
                         return;
@@ -215,6 +221,12 @@
                 }
                 this.CloseForm();
             };
+            //鏌ョ湅妯℃澘鏃�,涓嶅厑璁哥紪杈�
+            if (Common.Config.Instance.Home.IsShowTemplate == true)
+            {
+                btnFinish.CanClick = false;
+                btnSwingSwitch.CanClick = false;
+            }
         }
 
         #endregion
@@ -227,7 +239,7 @@
         private void InitTopRightMenu()
         {
             //妫�娴嬫鍥炶矾鏄惁鎷ユ湁瀹氫綅鍔熻兘(鎷跨鐐规渶灏忕殑閭d釜鍥炶矾鍘诲畾浣�)
-            bool canTest = Common.LocalDevice.Current.DeviceIsCanFixedPosition(deviceAc);
+            bool canTest = HdlDeviceCommonLogic.Current.DeviceIsCanFixedPosition(deviceAc);
             if (canTest == false)
             {
                 return;
@@ -254,7 +266,7 @@
             frame.AddRowMenu(deviceMenu, "Item/FixedPosition.png", "Item/FixedPositionSelected.png", () =>
             {
                 //鍙戦�佸畾浣嶅姛鑳�
-                Common.LocalDevice.Current.SetFixedPositionCommand(deviceAc);
+                HdlDeviceCommonLogic.Current.SetFixedPositionCommand(deviceAc);
             });
         }
 
@@ -267,10 +279,22 @@
         /// </summary>
         private bool ReadAirConditionerSwingModeSupport()
         {
-            string mainkeys = Common.LocalDevice.Current.GetDeviceMainKeys(deviceAc);
+            //濡傛灉鏄櫄鎷熶綇瀹�
+            if (Common.Config.Instance.Home.IsVirtually == true)
+            {
+                var data = HdlTemplateDeviceDataLogic.Current.GetAcSwingModeSupport(deviceAc);
+                //杞崲涓轰簩杩涘埗
+                var value = Convert.ToString(data, 2).PadLeft(16, '0');
+                //杩欎釜璁剧疆鏄斁鍦ㄥ悗闈㈢殑
+                this.fixValue = value.Substring(0, value.Length - 1);
+                this.swingMode = Convert.ToInt32(value.Substring(this.fixValue.Length));
+                return true;
+            }
+
+            string mainkeys = HdlDeviceCommonLogic.Current.GetDeviceMainKeys(deviceAc);
             HdlGatewayReceiveLogic.Current.AddAttributeEvent("ReadAirConditionerModeSupport", ReceiveComandDiv.A璁惧灞炴�т笂鎶�, (report) =>
             {
-                string checkKeys = Common.LocalDevice.Current.GetDeviceMainKeys(report);
+                string checkKeys = HdlDeviceCommonLogic.Current.GetDeviceMainKeys(report);
                 if (checkKeys != mainkeys || report.DeviceStatusReport.CluterID != 514)
                 {
                     return;
@@ -302,7 +326,7 @@
             {
                 //鑾峰彇绌鸿皟鎽嗛鐘舵�佸け璐�
                 string msg = Language.StringByID(R.MyInternationalizationString.uGetAirConditionerSwingFunctionFail);
-                msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, null, "鍥炲瓒呮椂");
+                msg = HdlCommonLogic.Current.CombineGatewayTimeOutMsg(msg, null, "鍥炲瓒呮椂");
                 this.ShowMassage(ShowMsgType.Tip, msg);
                 return false;
             }

--
Gitblit v1.8.0