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/MainPage/ControlForm/DeviceAcDetailCardForm.cs |  158 +++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 111 insertions(+), 47 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/MainPage/ControlForm/DeviceAcDetailCardForm.cs b/ZigbeeApp/Shared/Phone/MainPage/ControlForm/DeviceAcDetailCardForm.cs
index 6b371cf..9f402a0 100755
--- a/ZigbeeApp/Shared/Phone/MainPage/ControlForm/DeviceAcDetailCardForm.cs
+++ b/ZigbeeApp/Shared/Phone/MainPage/ControlForm/DeviceAcDetailCardForm.cs
@@ -84,8 +84,8 @@
             //娓呮礂婊ょ綉鎻愮ず鐨凢rameLayout
             this.frameClrean = new FrameLayout();
             frameClrean.Width = Application.GetRealWidth(600);
-            frameClrean.Height = Application.GetMinRealAverage(69);
-            frameClrean.X = ControlCommonResourse.XXLeft;
+            frameClrean.Height = this.GetPictrueRealSize(69);
+            frameClrean.X = HdlControlResourse.XXLeft;
             frameClrean.Y = Application.GetRealHeight(35);
             frameWhiteBack.AddChidren(frameClrean);
             frameClrean.Visible = false;
@@ -117,8 +117,8 @@
             //绌鸿皟鎺т欢鐨勫鍣�
             var frameAcBack = new FrameLayout();
             frameAcBack.Y = Application.GetRealHeight(412);
-            frameAcBack.Width = Application.GetMinRealAverage(671);
-            frameAcBack.Height = Application.GetMinRealAverage(671);
+            frameAcBack.Width = this.GetPictrueRealSize(671);
+            frameAcBack.Height = this.GetPictrueRealSize(671);
             frameAcBack.Gravity = Gravity.CenterHorizontal;
             frameWhiteBack.AddChidren(frameAcBack);
 
@@ -146,7 +146,7 @@
 
             //绌鸿皟鎺т欢閲岄潰鐨勯偅涓樉绀哄埗鐑�,鍒跺喎鐨勬帶浠�
             this.btnNowModeView = new NormalViewControl(200, 55, true);
-            btnNowModeView.Y = Application.GetMinRealAverage(184);
+            btnNowModeView.Y = this.GetPictrueRealSize(184);
             btnNowModeView.Gravity = Gravity.CenterHorizontal;
             btnNowModeView.Text = DeviceAcDetailCardMethord.GetModeNameByModeId(deviceAc.currentSystemMode);
             btnNowModeView.TextSize = 12;
@@ -157,8 +157,8 @@
             this.btnReduce = new IconViewControl(81);
             btnReduce.CanClick = isAcOpen;
             btnReduce.UnSelectedImagePath = "AC/Reduce.png";
-            btnReduce.X = Application.GetMinRealAverage(132);
-            btnReduce.Y = Application.GetMinRealAverage(268);
+            btnReduce.X = this.GetPictrueRealSize(132);
+            btnReduce.Y = this.GetPictrueRealSize(268);
             frameAcBack.AddChidren(btnReduce);
             btnReduce.ButtonClickEvent += (sender, e) =>
             {
@@ -173,7 +173,7 @@
             this.btnAdd = new IconViewControl(81);
             btnAdd.CanClick = isAcOpen;
             btnAdd.UnSelectedImagePath = "AC/Add.png";
-            btnAdd.X = frameAcBack.Width - Application.GetMinRealAverage(81 + 132);
+            btnAdd.X = frameAcBack.Width - this.GetPictrueRealSize(81 + 132);
             btnAdd.Y = btnReduce.Y;
             frameAcBack.AddChidren(btnAdd);
             btnAdd.ButtonClickEvent += (sender, e) =>
@@ -187,7 +187,7 @@
 
             //鈩�
             var btnUint = new NormalViewControl(100, 66, true);
-            btnUint.Y = Application.GetMinRealAverage(366);
+            btnUint.Y = this.GetPictrueRealSize(366);
             btnUint.Gravity = Gravity.CenterHorizontal;
             btnUint.TextAlignment = TextAlignment.Center;
             btnUint.Text = "鈩�";
@@ -301,7 +301,7 @@
         {
             //婊戝姩杩囩▼涓�
             int oldProgressValue = arcScaleSeekBar.Progress;//涔嬪墠鐨勫��
-            arcScaleSeekBar.OnProgressChangedEvent += (send2, value) =>
+            arcScaleSeekBar.OnStopTrackingTouchEvent += (send2, value) =>
             {
                 nowProgressValue = value;
             };
@@ -358,14 +358,35 @@
             //鍙戦�佽繘搴﹀��
             if (deviceAc.currentSystemMode == 3 || deviceAc.currentSystemMode == 8)
             {
+                //濡傛灉浣忓畢鏄櫄鎷熶綇瀹�
+                if (Common.Config.Instance.Home.IsVirtually == true)
+                {
+                    this.canSetProgress = true;
+                    deviceAc.currentCoolingSetpoint = value;
+                    return;
+                }
                 deviceAc.SetCoolingTemperatureAsync(value * 100);
             }
             else if (deviceAc.currentSystemMode == 4)
             {
+                //濡傛灉浣忓畢鏄櫄鎷熶綇瀹�
+                if (Common.Config.Instance.Home.IsVirtually == true)
+                {
+                    this.canSetProgress = true;
+                    deviceAc.currentHeatingSetpoint = value;
+                    return;
+                }
                 deviceAc.SetHeatingTemperatureAsync(value * 100);
             }
             else if (deviceAc.currentSystemMode == 1)
             {
+                //濡傛灉浣忓畢鏄櫄鎷熶綇瀹�
+                if (Common.Config.Instance.Home.IsVirtually == true)
+                {
+                    this.canSetProgress = true;
+                    deviceAc.currentAutoSetpoint = value;
+                    return;
+                }
                 deviceAc.SetAutoTemperatureAsync(value * 100);
             }
         }
@@ -439,7 +460,7 @@
         {
             var rowFrame = new FrameRowControl();
             rowFrame.Y = frameBack.GetChildren(frameBack.ChildrenCount - 1).Bottom;
-            rowFrame.LeftOffset = Application.GetRealWidth(81) - ControlCommonResourse.XXLeft;
+            rowFrame.LeftOffset = Application.GetRealWidth(81) - HdlControlResourse.XXLeft;
             rowFrame.Height = Application.GetRealHeight(150);
             frameBack.AddChidren(rowFrame);
 
@@ -480,6 +501,16 @@
         /// <param name="fanSwingMode">Fan mode.</param>
         private void SetFanSwingComand(AC.FanSwingMode fanSwingMode)
         {
+            //濡傛灉浣忓畢涓鸿櫄鎷熶綇瀹�,鍒欑洿鎺ヤ慨鏀圭紦瀛�
+            if (Common.Config.Instance.Home.IsVirtually == true)
+            {
+                deviceAc.currentFanSwingMode = (int)fanSwingMode;
+                var tempDevice = new CommonDevice();
+                tempDevice.DeviceStatusReport = new CommonDevice.DeviceStatusReportData() { CluterID = 514 };
+                tempDevice.DeviceStatusReport.AttriBute = new List<CommonDevice.AttributeDataObj>() { new CommonDevice.AttributeDataObj() { AttributeId = 4096 } };
+                this.CheckResponeResultStatu(ReceiveComandDiv.A璁惧灞炴�т笂鎶�, tempDevice);
+                return;
+            }
             var oldModel = (AC.FanSwingMode)deviceAc.currentFanSwingMode;
             if (oldModel == fanSwingMode)
             {
@@ -489,20 +520,16 @@
             //妫�娴嬫槸鍚﹁幏鍙栫綉鍏冲弽棣堢殑缁撴灉,濡傛灉缃戝叧娌℃湁鍥炲,鍒欎細寮瑰嚭娑堟伅
             this.StartCheckResponeResult(this.listControl, (result) =>
             {
-                //娌℃湁鎺ユ敹鍒扮綉鍏冲洖澶�
-                if (result == false)
+                if (result == true)
                 {
+                    //鎺ユ敹鍒扮綉鍏崇殑鍥炲
                     HdlThreadLogic.Current.RunMain(() =>
                     {
-                        //杩樺師鐘舵��
-                        listControl[0].SelectedImagePath = DeviceAcDetailCardMethord.GetFanSwingModeSelectedImagePathByFanSwingMode(oldModel);
-                        listControl[0].UnSelectedImagePath = DeviceAcDetailCardMethord.GetFanSwingModeUnSelectedImagePathByFanSwingMode(oldModel);
+                        listControl[0].SelectedImagePath = DeviceAcDetailCardMethord.GetFanSwingModeSelectedImagePathByFanSwingMode(fanSwingMode);
+                        listControl[0].UnSelectedImagePath = DeviceAcDetailCardMethord.GetFanSwingModeUnSelectedImagePathByFanSwingMode(fanSwingMode);
                     });
                 }
             });
-
-            listControl[0].SelectedImagePath = DeviceAcDetailCardMethord.GetFanSwingModeSelectedImagePathByFanSwingMode(fanSwingMode);
-            listControl[0].UnSelectedImagePath = DeviceAcDetailCardMethord.GetFanSwingModeUnSelectedImagePathByFanSwingMode(fanSwingMode);
 
             deviceAc.SetFanSwingAsyncMode(fanSwingMode);
         }
@@ -598,7 +625,7 @@
         {
             var rowFrame = new FrameRowControl();
             rowFrame.Y = frameBack.GetChildren(frameBack.ChildrenCount - 1).Bottom;
-            rowFrame.LeftOffset = Application.GetRealWidth(81) - ControlCommonResourse.XXLeft;
+            rowFrame.LeftOffset = Application.GetRealWidth(81) - HdlControlResourse.XXLeft;
             rowFrame.Height = Application.GetRealHeight(150);
             frameBack.AddChidren(rowFrame);
 
@@ -645,23 +672,43 @@
                 //閫夋嫨鐨勬槸鍚屼竴涓�
                 return;
             }
+
+            //濡傛灉浣忓畢涓鸿櫄鎷熶綇瀹�,鍒欑洿鎺ヤ慨鏀圭紦瀛�
+            if (Common.Config.Instance.Home.IsVirtually == true)
+            {
+                deviceAc.currentSystemMode = (int)mode;
+                var tempDevice = new CommonDevice();
+                tempDevice.DeviceStatusReport = new CommonDevice.DeviceStatusReportData() { CluterID = 513 };
+                tempDevice.DeviceStatusReport.AttriBute = new List<CommonDevice.AttributeDataObj>() { new CommonDevice.AttributeDataObj() { AttributeId = 28 } };
+                this.CheckResponeResultStatu(ReceiveComandDiv.A璁惧灞炴�т笂鎶�, tempDevice);
+                //閫侀鐨勬椂鍊�,娌℃湁娓╁害鐨勬蹇�
+                if (mode == AC.AcMode.FanOnly)
+                {
+                    //鍔犲噺涓嶅彲浠ョ偣鍑�
+                    btnAdd.CanClick = false;
+                    btnReduce.CanClick = false;
+                }
+                //濡傛灉鍘熸潵鐨勭姸鎬佹槸閫侀鐨勮瘽
+                else if (oldModel == AC.AcMode.FanOnly)
+                {
+                    //鍔犲噺鍙互鐐瑰嚮
+                    btnAdd.CanClick = true;
+                    btnReduce.CanClick = true;
+                }
+                return;
+            }
+
             //妫�娴嬫槸鍚﹁幏鍙栫綉鍏冲弽棣堢殑缁撴灉,濡傛灉缃戝叧娌℃湁鍥炲,鍒欎細寮瑰嚭娑堟伅
             this.StartCheckResponeResult(this.listControl, (result) =>
             {
-                //娌℃湁鎺ユ敹鍒扮綉鍏冲洖澶�
-                if (result == false)
+                if (result == true)
                 {
+                    //鎺ユ敹鍒扮綉鍏冲洖澶�
                     HdlThreadLogic.Current.RunMain(() =>
                     {
-                        //杩樺師鐘舵��
-                        listControl[1].SelectedImagePath = DeviceAcDetailCardMethord.GetModeSelectedImagePathByMode(oldModel);
-                        listControl[1].UnSelectedImagePath = DeviceAcDetailCardMethord.GetModeUnSelectedImagePathByMode(oldModel);
-                    });
-                }
-                else
-                {
-                    HdlThreadLogic.Current.RunMain(() =>
-                    {
+                        listControl[1].SelectedImagePath = DeviceAcDetailCardMethord.GetModeSelectedImagePathByMode(mode);
+                        listControl[1].UnSelectedImagePath = DeviceAcDetailCardMethord.GetModeUnSelectedImagePathByMode(mode);
+
                         //閫侀鐨勬椂鍊�,娌℃湁娓╁害鐨勬蹇�
                         if (mode == AC.AcMode.FanOnly)
                         {
@@ -684,10 +731,6 @@
                     });
                 }
             });
-
-            listControl[1].SelectedImagePath = DeviceAcDetailCardMethord.GetModeSelectedImagePathByMode(mode);
-            listControl[1].UnSelectedImagePath = DeviceAcDetailCardMethord.GetModeUnSelectedImagePathByMode(mode);
-
             deviceAc.SetSystemModeAsync(mode);
         }
 
@@ -718,6 +761,20 @@
         /// <param name="isOpen"></param>
         private void SetSwitchComand(bool isOpen)
         {
+            //濡傛灉浣忓畢涓鸿櫄鎷熶綇瀹�,鍒欑洿鎺ヤ慨鏀圭紦瀛�
+            if (Common.Config.Instance.Home.IsVirtually == true)
+            {
+                deviceAc.currentSystemMode = isOpen == true ? 3 : 0;
+                var tempDevice = new CommonDevice();
+                tempDevice.DeviceStatusReport = new CommonDevice.DeviceStatusReportData() { CluterID = 513 };
+                tempDevice.DeviceStatusReport.AttriBute = new List<CommonDevice.AttributeDataObj>() { new CommonDevice.AttributeDataObj() { AttributeId = 28 } };
+                this.CheckResponeResultStatu(ReceiveComandDiv.A璁惧灞炴�т笂鎶�, tempDevice);
+                //鍔犲噺鏄惁鍙互鐐瑰嚮
+                btnAdd.CanClick = isOpen;
+                btnReduce.CanClick = isOpen;
+                return;
+            }
+
             //妫�娴嬫槸鍚﹁幏鍙栫綉鍏冲弽棣堢殑缁撴灉,濡傛灉缃戝叧娌℃湁鍥炲,鍒欎細寮瑰嚭娑堟伅
             this.StartCheckResponeResult(this.listControl, (result) =>
             {
@@ -729,6 +786,7 @@
                         //閭e洓涓浘鏍囧彉鏇�
                         this.listControl[0].IsSelected = isOpen;
                         this.listControl[1].IsSelected = isOpen;
+                        this.listControl[2].IsSelected = isOpen;
                         this.listControl[3].IsSelected = isOpen;
                         if (isOpen == true)
                         {
@@ -752,7 +810,6 @@
                 }
             });
 
-            this.listControl[2].IsSelected = isOpen;
             if (isOpen == true)
             {
                 deviceAc.Open();
@@ -823,7 +880,7 @@
         {
             var rowFrame = new FrameRowControl();
             rowFrame.Y = frameBack.GetChildren(frameBack.ChildrenCount - 1).Bottom;
-            rowFrame.LeftOffset = Application.GetRealWidth(81) - ControlCommonResourse.XXLeft;
+            rowFrame.LeftOffset = Application.GetRealWidth(81) - HdlControlResourse.XXLeft;
             rowFrame.Height = Application.GetRealHeight(150);
             frameBack.AddChidren(rowFrame);
 
@@ -853,6 +910,17 @@
             rowFrame.ButtonClickEvent += (sender, e) =>
             {
                 ((DialogCommonForm)frameBack.Parent.Parent).CloseForm();
+
+                //濡傛灉浣忓畢涓鸿櫄鎷熶綇瀹�,鍒欑洿鎺ヤ慨鏀圭紦瀛�
+                if (Common.Config.Instance.Home.IsVirtually == true)
+                {
+                    deviceAc.currentFanMode = (int)i_div;
+                    var tempDevice = new CommonDevice();
+                    tempDevice.DeviceStatusReport = new CommonDevice.DeviceStatusReportData() { CluterID = 514 };
+                    tempDevice.DeviceStatusReport.AttriBute = new List<CommonDevice.AttributeDataObj>() { new CommonDevice.AttributeDataObj() { AttributeId = 0 } };
+                    this.CheckResponeResultStatu(ReceiveComandDiv.A璁惧灞炴�т笂鎶�, tempDevice);
+                    return;
+                }
                 //鍙戦�侀閫熷懡浠�
                 this.SetAcWindSpeedComand(i_div);
             };
@@ -873,20 +941,16 @@
             //妫�娴嬫槸鍚﹁幏鍙栫綉鍏冲弽棣堢殑缁撴灉,濡傛灉缃戝叧娌℃湁鍥炲,鍒欎細寮瑰嚭娑堟伅
             this.StartCheckResponeResult(this.listControl, (result) =>
             {
-                //娌℃湁鎺ユ敹鍒扮綉鍏冲洖澶�
-                if (result == false)
+                //鎺ユ敹鍒扮綉鍏冲洖澶�
+                if (result == true)
                 {
                     HdlThreadLogic.Current.RunMain(() =>
                     {
-                        //杩樺師鐘舵��
-                        listControl[3].SelectedImagePath = DeviceAcDetailCardMethord.GetFanModeSelectedImagePathByFanMode(oldModel);
-                        listControl[3].UnSelectedImagePath = DeviceAcDetailCardMethord.GetFanModeSelectedImagePathByFanMode(oldModel);
+                        listControl[3].SelectedImagePath = DeviceAcDetailCardMethord.GetFanModeSelectedImagePathByFanMode(mode);
+                        listControl[3].UnSelectedImagePath = DeviceAcDetailCardMethord.GetFanModeSelectedImagePathByFanMode(mode);
                     });
                 }
             });
-
-            listControl[3].SelectedImagePath = DeviceAcDetailCardMethord.GetFanModeSelectedImagePathByFanMode(mode);
-            listControl[3].UnSelectedImagePath = DeviceAcDetailCardMethord.GetFanModeSelectedImagePathByFanMode(mode);
 
             deviceAc.SetFanModeAsync(mode);
         }
@@ -988,8 +1052,8 @@
                                         this.listControl[1].IsSelected = false;
                                         this.listControl[2].IsSelected = false;
                                         this.listControl[3].IsSelected = false;
-                                        arcScaleSeekBar.SetProgressBarColors(ZigbeeColor.Current.GXCWaveSeekBarUnSelectedColor, ZigbeeColor.Current.GXCWaveSeekBarUnSelectedColor);
                                     }
+                                    arcScaleSeekBar.SetProgressBarColors(ZigbeeColor.Current.GXCWaveSeekBarUnSelectedColor, ZigbeeColor.Current.GXCWaveSeekBarUnSelectedColor);
                                     //璁剧疆鐘舵�佹枃瀛� 鍏抽棴
                                     this.SetStatuText(Language.StringByID(R.MyInternationalizationString.Close));
                                     return;
@@ -1004,8 +1068,8 @@
                                         this.listControl[1].IsSelected = true;
                                         this.listControl[2].IsSelected = true;
                                         this.listControl[3].IsSelected = true;
-                                        arcScaleSeekBar.SetProgressBarColors(ZigbeeColor.Current.GXCArcScaleSeekBarStartColor, ZigbeeColor.Current.GXCArcScaleSeekBarEndColor);
                                     }
+                                    arcScaleSeekBar.SetProgressBarColors(ZigbeeColor.Current.GXCArcScaleSeekBarStartColor, ZigbeeColor.Current.GXCArcScaleSeekBarEndColor);
                                 }
                                 this.listControl[1].SelectedImagePath = DeviceAcDetailCardMethord.GetModeSelectedImagePathByModeId(deviceAc.currentSystemMode);
                                 this.listControl[1].UnSelectedImagePath = DeviceAcDetailCardMethord.GetModeUnSelectedImagePathByModeId(deviceAc.currentSystemMode);

--
Gitblit v1.8.0