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/MainPage/ControlForm/DeviceCurtainDetailCardForm.cs |   96 +++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 74 insertions(+), 22 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/MainPage/ControlForm/DeviceCurtainDetailCardForm.cs b/ZigbeeApp/Shared/Phone/MainPage/ControlForm/DeviceCurtainDetailCardForm.cs
index 8fb999c..290933b 100755
--- a/ZigbeeApp/Shared/Phone/MainPage/ControlForm/DeviceCurtainDetailCardForm.cs
+++ b/ZigbeeApp/Shared/Phone/MainPage/ControlForm/DeviceCurtainDetailCardForm.cs
@@ -83,6 +83,22 @@
             btnOpen.Y = Application.GetRealHeight(994) - btnOpen.YOffset;
             btnOpen.ButtonClickEvent += (sender, e) =>
             {
+                //濡傛灉浣忓畢涓鸿櫄鎷熶綇瀹�,鍒欐鍔熻兘鏃犳晥
+                if (Common.Config.Instance.Home.IsVirtually == true)
+                {
+                    ((Rollershade)device).WcdCurrentPositionLiftPercentage = 100;
+                    if (this.WcdType == 0)
+                    {
+                        SeekBarSiphonateCurtain.Progress = 100;
+                    }
+                    else
+                    {
+                        SeekBarOpenCurtain.Progress = 100;
+                    }
+                    //璁剧疆鐘舵�佹枃瀛�
+                    this.SetStatuText(HdlDeviceOtherLogic.Current.GetDeviceStatu(this.device));
+                    return;
+                }
                 //鍙戦�佺獥甯樺懡浠�
                 this.SetCurtainCommand(0);
             };
@@ -98,6 +114,11 @@
             btnStop.Y = btnOpen.Y;
             btnStop.ButtonClickEvent += (sender, e) =>
             {
+                //濡傛灉浣忓畢涓鸿櫄鎷熶綇瀹�,鍒欐鍔熻兘鏃犳晥
+                if (Common.Config.Instance.Home.IsVirtually == true)
+                {
+                    return;
+                }
                 //鍙戦�佺獥甯樺懡浠�
                 this.SetCurtainCommand(2);
             };
@@ -111,6 +132,22 @@
             btnClose.Y = btnOpen.Y;
             btnClose.ButtonClickEvent += (sender, e) =>
             {
+                //濡傛灉浣忓畢涓鸿櫄鎷熶綇瀹�,鍒欐鍔熻兘鏃犳晥
+                if (Common.Config.Instance.Home.IsVirtually == true)
+                {
+                    ((Rollershade)device).WcdCurrentPositionLiftPercentage = 0;
+                    if (this.WcdType == 0)
+                    {
+                        SeekBarSiphonateCurtain.Progress = 0;
+                    }
+                    else
+                    {
+                        SeekBarOpenCurtain.Progress = 0;
+                    }
+                    //璁剧疆鐘舵�佹枃瀛�
+                    this.SetStatuText(HdlDeviceOtherLogic.Current.GetDeviceStatu(this.device));
+                    return;
+                }
                 //鍙戦�佺獥甯樺懡浠�
                 this.SetCurtainCommand(1);
             };
@@ -143,13 +180,12 @@
             //鍗峰笜鎺т欢
             this.SeekBarSiphonateCurtain = new CurtainRollSeekBar();
             SeekBarSiphonateCurtain.Y = Application.GetRealHeight(300);
-            SeekBarSiphonateCurtain.Width = Application.GetMinRealAverage(438);
-            SeekBarSiphonateCurtain.Height = Application.GetMinRealAverage(576);
+            SeekBarSiphonateCurtain.Width = this.GetPictrueRealSize(438);
+            SeekBarSiphonateCurtain.Height = this.GetPictrueRealSize(576);
             SeekBarSiphonateCurtain.Gravity = Gravity.CenterHorizontal;
             SeekBarSiphonateCurtain.Progress = (device as Rollershade).WcdCurrentPositionLiftPercentage;
             frameWhiteBack.AddChidren(SeekBarSiphonateCurtain);
             SeekBarSiphonateCurtain.IsProgressTextShow = false;
-            SeekBarSiphonateCurtain.CurtainPaddingTop = Application.GetRealHeight(110);
 
             //鍗峰笜鎺т欢閲岄潰鐨勯偅涓樉绀虹櫨鍒嗘瘮鐨勬帶浠�
             int progressY = SeekBarSiphonateCurtain.Y - Application.GetMinReal(204);
@@ -193,7 +229,16 @@
                 //鍙樻洿杩涘害鐧惧垎姣旂殑鏄剧ず
                 btnProgress.Y = progressY + SeekBarSiphonateCurtain.NowProgressY;
                 btnProgress.Text = value + "%";
-                nowProgressValue = value;
+
+                if (Common.Config.Instance.Home.IsVirtually == false)
+                {
+                    nowProgressValue = value;
+                }
+                else
+                {
+                    //濡傛灉浣忓畢涓鸿櫄鎷熶綇瀹�,鐩存帴鏀圭紦瀛�
+                    (device as Rollershade).WcdCurrentPositionLiftPercentage = value;
+                }
             };
 
             if (this.hadInitControl == true)
@@ -233,8 +278,8 @@
             //寮�鍚堝笜鎺т欢
             this.SeekBarOpenCurtain = new CurtainSeekBar();
             SeekBarOpenCurtain.Y = Application.GetRealHeight(334);
-            SeekBarOpenCurtain.Width = Application.GetMinRealAverage(570);
-            SeekBarOpenCurtain.Height = Application.GetMinRealAverage(513);
+            SeekBarOpenCurtain.Width = this.GetPictrueRealSize(570);
+            SeekBarOpenCurtain.Height = this.GetPictrueRealSize(513);
             SeekBarOpenCurtain.Gravity = Gravity.CenterHorizontal;
             SeekBarOpenCurtain.IsProgressTextShow = false;
             SeekBarOpenCurtain.Progress = (device as Rollershade).WcdCurrentPositionLiftPercentage;
@@ -280,7 +325,16 @@
             {
                 btnProgress.X = progressX + SeekBarOpenCurtain.NowProgressX - Application.GetMinReal(5);
                 btnProgress.Text = value + "%";
-                nowProgressValue = value;
+
+                if (Common.Config.Instance.Home.IsVirtually == false)
+                {
+                    nowProgressValue = value;
+                }
+                else
+                {
+                    //濡傛灉浣忓畢涓鸿櫄鎷熶綇瀹�,鐩存帴淇敼缂撳瓨
+                    (device as Rollershade).WcdCurrentPositionLiftPercentage = value;
+                }
             };
 
             //寮�涓�涓嚎绋�,鐩戣鏄惁婊戝姩鐨勬粦鍔ㄦ潯,姣忕妫�娴嬩竴娆�
@@ -311,19 +365,20 @@
         /// <param name="comand"></param>
         private void SetCurtainCommand(int comand)
         {
+            //2020.07.20鍙樻洿:鏀惧紑闄愬埗,涓嶅啀绛夊緟缃戝叧鍥炲,涔熻兘鐐瑰嚮鎸夐挳
             //鍦ㄦ病鏈夋帴鏀跺埌鍙嶉涔嬪墠,涓嶈兘鍐嶇偣鍑�
-            this.btnClose.CanClick = false;
-            this.btnOpen.CanClick = false;
-            this.btnStop.CanClick = false;
+            //this.btnClose.CanClick = false;
+            //this.btnOpen.CanClick = false;
+            //this.btnStop.CanClick = false;
 
             //妫�娴嬫槸鍚﹁幏鍙栫綉鍏冲弽棣堢殑缁撴灉,濡傛灉缃戝叧娌℃湁鍥炲,鍒欎細寮瑰嚭娑堟伅
-            this.StartCheckResponeResult(new List<ButtonBase>(), (result) =>
-            {
-                //鏃堕棿缁撴潫,鍙互鍐嶆鐐瑰嚮
-                this.btnClose.CanClick = true;
-                this.btnOpen.CanClick = true;
-                this.btnStop.CanClick = true;
-            });
+            //this.StartCheckResponeResult(new List<ButtonBase>(), (result) =>
+            //{
+            //    //鏃堕棿缁撴潫,鍙互鍐嶆鐐瑰嚮
+            //    this.btnClose.CanClick = true;
+            //    this.btnOpen.CanClick = true;
+            //    this.btnStop.CanClick = true;
+            //});
             //鍙戦�佸懡浠�
             ((Rollershade)device).CurtainUpDownStopControl(comand);
         }
@@ -340,11 +395,7 @@
         /// <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(() =>
                 {
@@ -363,6 +414,7 @@
                         }
                     }
                 });
+                return true;
             }
             return false;
         }

--
Gitblit v1.8.0