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/DeviceRelayDetailCardForm.cs |   50 ++++++++++++++++++++++++--------------------------
 1 files changed, 24 insertions(+), 26 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/MainPage/ControlForm/DeviceRelayDetailCardForm.cs b/ZigbeeApp/Shared/Phone/MainPage/ControlForm/DeviceRelayDetailCardForm.cs
index 542282a..4fc958a 100755
--- a/ZigbeeApp/Shared/Phone/MainPage/ControlForm/DeviceRelayDetailCardForm.cs
+++ b/ZigbeeApp/Shared/Phone/MainPage/ControlForm/DeviceRelayDetailCardForm.cs
@@ -47,7 +47,7 @@
                 this.InitLightControl(frameWhiteBack);
             }
             //璁剧疆鐘舵�佹枃瀛�
-            this.SetStatuText(HdlDeviceOtherLogic.Current.GetDeviceStatu(this.device));
+            this.SetStatuText(HdlDeviceCommonLogic.Current.GetMainPageDeviceStatuText(this.device));
         }
 
         #endregion
@@ -109,8 +109,8 @@
         {
             //寮�鍏崇殑鑳屾櫙鍥剧墖
             var picSwitchBack = new FrameLayout();
-            picSwitchBack.Height = Application.GetMinRealAverage(579);
-            picSwitchBack.Width = Application.GetMinRealAverage(579);
+            picSwitchBack.Height = this.GetPictrueRealSize(579);
+            picSwitchBack.Width = this.GetPictrueRealSize(579);
             picSwitchBack.Y = Application.GetRealHeight(340);
             picSwitchBack.BackgroundImagePath = "Light/OnOff.png";
             picSwitchBack.Gravity = Gravity.CenterHorizontal;
@@ -120,8 +120,8 @@
             var btnClose = new IconViewControl(81);
             btnClose.UnSelectedImagePath = "Light/OFF.png";
             btnClose.SelectedImagePath = "Light/OFFSelected.png";
-            btnClose.X = Application.GetMinRealAverage(101);
-            btnClose.Y = Application.GetMinRealAverage(248);
+            btnClose.X = this.GetPictrueRealSize(101);
+            btnClose.Y = this.GetPictrueRealSize(248);
             picSwitchBack.AddChidren(btnClose);
             listControl.Add(btnClose);
 
@@ -129,7 +129,7 @@
             var btnOpen = new IconViewControl(81);
             btnOpen.UnSelectedImagePath = "Light/ON.png";
             btnOpen.SelectedImagePath = "Light/ONSelected.png";
-            btnOpen.X = Application.GetMinRealAverage(397);
+            btnOpen.X = this.GetPictrueRealSize(397);
             btnOpen.Y = btnClose.Y;
             picSwitchBack.AddChidren(btnOpen);
             listControl.Add(btnOpen);
@@ -215,9 +215,6 @@
         /// <param name="isOpen">鎵撳紑鐘舵��</param>
         private void RefreshSwitchStatu(bool isOpen)
         {
-            //鐘舵�佷竴鑷�(绗簩绱㈠紩鐨勬帶浠跺鏋滄槸閫夋嫨鐘舵��,鍒欏繀瀹氫负寮�鐘舵��)
-            if (listControl[1].IsSelected == isOpen) { return; }
-
             //鍙樻洿鐘舵��
             if (this.device.DfunctionType == DeviceFunctionType.A寮�鍏�)
             {
@@ -232,6 +229,8 @@
                 listControl[0].IsSelected = isOpen;
                 listControl[1].IsSelected = isOpen;
             }
+            //璁剧疆鐘舵�佹枃瀛�
+            this.SetStatuText(HdlDeviceCommonLogic.Current.GetMainPageDeviceStatuText(this.device));
         }
 
         #endregion
@@ -246,19 +245,14 @@
         /// <returns></returns>
         public override bool CheckResponeResultStatu(ReceiveComandDiv comandDiv, CommonDevice report)
         {
-            if (comandDiv == ReceiveComandDiv.A鑺傜偣鎺у埗鍙嶉)
-            {
-                return true;
-            }
-            else if (comandDiv == ReceiveComandDiv.A璁惧灞炴�т笂鎶�)
+            if (comandDiv == ReceiveComandDiv.A璁惧灞炴�т笂鎶�)
             {
                 HdlThreadLogic.Current.RunMain(() =>
                 {
                     //鍙樻洿鍗$墖鐘舵��
                     this.RefreshSwitchStatu(((LightBase)this.device).OnOffStatus == 1);
-                    //璁剧疆鐘舵�佹枃瀛�
-                    this.SetStatuText(HdlDeviceOtherLogic.Current.GetDeviceStatu(this.device));
                 });
+                return true;
             }
             return false;
         }
@@ -273,32 +267,36 @@
         /// <param name="isOpen"></param>
         private void SetSwitchCommand(bool isOpen)
         {
+            //濡傛灉浣忓畢涓鸿櫄鎷熶綇瀹�
+            if (Common.Config.Instance.Home.IsVirtually == true)
+            {
+                ((LightBase)this.device).OnOffStatus = isOpen == true ? 1 : 0;
+                //鍙樻洿鍗$墖鐘舵��
+                this.RefreshSwitchStatu(((LightBase)this.device).OnOffStatus == 1);
+                return;
+            }
             //妫�娴嬫槸鍚﹁幏鍙栫綉鍏冲弽棣堢殑缁撴灉,濡傛灉缃戝叧娌℃湁鍥炲,鍒欎細寮瑰嚭娑堟伅
             this.StartCheckResponeResult(this.listControl, (result) =>
             {
-                //娌℃湁鎺ユ敹鍒扮綉鍏冲洖澶�
-                if (result == false)
+                //鎺ユ敹鍒扮綉鍏冲洖澶�
+                if (result == true)
                 {
                     HdlThreadLogic.Current.RunMain(() =>
-                    {             
-                        //璁剧疆鐘舵�佹枃瀛�
-                        this.SetStatuText(HdlDeviceOtherLogic.Current.GetDeviceStatu(this.device));
+                    {
+                        //鍙樻洿鍗$墖鐘舵��
+                        bool statu = ((LightBase)this.device).OnOffStatus == 1;
+                        this.RefreshSwitchStatu(statu);
                     });
                 }
             });
-            //鍙樻洿鍗$墖鐘舵��
-            this.RefreshSwitchStatu(isOpen);
-
             if (isOpen == true)
             {
                 //鎵撳紑
-                this.SetStatuText(Language.StringByID(R.MyInternationalizationString.uOpen1));
                 this.device.SwitchControl(1);
             }
             else
             {
                 //鍏抽棴
-                this.SetStatuText(Language.StringByID(R.MyInternationalizationString.Close));
                 this.device.SwitchControl(0);
             }
         }

--
Gitblit v1.8.0