From 25429f085093d89d543a0b90e30d0d62d1b7dac9 Mon Sep 17 00:00:00 2001
From: hxb <hxb@hdlchina.com.cn>
Date: 星期二, 30 八月 2022 09:37:38 +0800
Subject: [PATCH] 合并了IOS的代码

---
 ZigbeeApp/Shared/Phone/UserCenter/Device/AirConditioner/AirConditionerModeForm.cs |   67 ++++++++++++++++++++++-----------
 1 files changed, 45 insertions(+), 22 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/AirConditioner/AirConditionerModeForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/AirConditioner/AirConditionerModeForm.cs
index f7f00c0..365b2d7 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/Device/AirConditioner/AirConditionerModeForm.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/AirConditioner/AirConditionerModeForm.cs
@@ -52,7 +52,7 @@
         }
 
         /// <summary>
-        /// 鍒濆鍖栦腑閮ㄤ俊鎭�
+        /// 鍒濆鍖栦腑閮ㄤ俊鎭� 鈽嗏槅鈽嗏槅鈽�
         /// </summary>
         private void InitMiddleFrame()
         {
@@ -106,28 +106,33 @@
                     var btnOk = new BottomClickButton();
                     btnOk.TextID = R.MyInternationalizationString.uSave;
                     bodyFrameLayout.AddChidren(btnOk);
-                    btnOk.ButtonClickEvent += async (sender, e) =>
-                     {
-                         if (this.oldReportValue == this.reportValue)
-                         {
+                    btnOk.ButtonClickEvent += (sender, e) =>
+                    {
+                        if (this.oldReportValue == this.reportValue)
+                        {
                             //鏁版嵁鐩稿悓,涓嶉渶瑕佷慨鏀�
                             this.CloseForm();
-                             return;
-                         }
-                         //灏嗕簩杩涘埗杞崲涓哄崄杩涘埗
-                         var data = Convert.ToInt32(this.fixValue + this.reportValue, 2);
-                         var result = await HdlDeviceAirConditionerLogic.Current.SetAcModeSupport(deviceAc, data);
-                         if (result == true)
-                         {
-                             //鏇存敼缂撳瓨
-                             for (int i = 0; i < this.reportValue.Length; i++)
-                             {
-                                 deviceAc.listSupportMode[i] = Convert.ToInt32(reportValue[i]);
-                             }
-                             deviceAc.ReSave();
-                             this.CloseForm();
-                         }
-                     };
+                            return;
+                        }
+                        //灏嗕簩杩涘埗杞崲涓哄崄杩涘埗
+                        var data = Convert.ToInt32(this.fixValue + this.reportValue, 2);
+                        var result = HdlDeviceAirConditionerLogic.Current.SetAcModeSupport(deviceAc, data);
+                        if (result == true)
+                        {
+                            //鏇存敼缂撳瓨
+                            for (int i = 0; i < this.reportValue.Length; i++)
+                            {
+                                deviceAc.listSupportMode[i] = Convert.ToInt32(reportValue[i].ToString());
+                            }
+                            deviceAc.ReSave();
+                            this.CloseForm();
+                        }
+                    };
+                    //濡傛灉鏄睍绀烘ā鏉�
+                    if (Common.Config.Instance.Home.IsShowTemplate == true)
+                    {
+                        btnOk.CanClick = false;
+                    }
                 });
             });
         }
@@ -174,6 +179,11 @@
                     this.reportValue = reportValue.Substring(0, div) + "0" + reportValue.Substring(div + 1);
                 }
             };
+            //濡傛灉鏄睍绀烘ā鏉�
+            if (Common.Config.Instance.Home.IsShowTemplate == true)
+            {
+                rowFrame.CanClick = false;
+            }
         }
 
         #endregion
@@ -181,10 +191,23 @@
         #region 鈻� 璇诲彇绌鸿皟鑷畾涔夋ā寮廮________________
 
         /// <summary>
-        /// 璇诲彇绌鸿皟鑷畾涔夋ā寮�
+        /// 璇诲彇绌鸿皟鑷畾涔夋ā寮� 鈽嗏槅鈽嗏槅鈽�
         /// </summary>
         private void ReadAirConditionerModeSupport()
         {
+            //濡傛灉鏄櫄鎷熶綇瀹�
+            if (Common.Config.Instance.Home.IsVirtually == true || Common.Config.Instance.Home.IsShowTemplate == true)
+            {
+                var data = TemplateData.TemplateDeviceDataLogic.Current.GetAcModeSupport(deviceAc);
+                //杞崲涓轰簩杩涘埗
+                var value = Convert.ToString(data, 2).PadLeft(16, '0');
+                //杩欎簲涓缃槸鏀惧湪鍚庨潰鐨�
+                this.fixValue = value.Substring(0, value.Length - 5);
+                this.reportValue = value.Substring(this.fixValue.Length);
+                oldReportValue = reportValue;
+                return;
+            }
+
             string mainkeys = Common.LocalDevice.Current.GetDeviceMainKeys(deviceAc);
             HdlGatewayReceiveLogic.Current.AddAttributeEvent("ReadAirConditionerModeSupport", ReceiveComandDiv.A璁惧灞炴�т笂鎶�, (report) =>
             {

--
Gitblit v1.8.0