From 9a4b76398009cf76c508d61f7e48fb6f5cb7ac2d Mon Sep 17 00:00:00 2001
From: xm <1271024303@qq.com>
Date: 星期二, 21 七月 2020 09:46:53 +0800
Subject: [PATCH] 请合并最新多功能面板代码

---
 ZigbeeApp/Shared/Phone/MainPage/ControlForm/DeviceColorLightDetailCardForm.cs |   63 +++++++++++++++++--------------
 1 files changed, 34 insertions(+), 29 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/MainPage/ControlForm/DeviceColorLightDetailCardForm.cs b/ZigbeeApp/Shared/Phone/MainPage/ControlForm/DeviceColorLightDetailCardForm.cs
index 53a0bff..cc9f72d 100755
--- a/ZigbeeApp/Shared/Phone/MainPage/ControlForm/DeviceColorLightDetailCardForm.cs
+++ b/ZigbeeApp/Shared/Phone/MainPage/ControlForm/DeviceColorLightDetailCardForm.cs
@@ -1,5 +1,4 @@
 锘縰sing Shared.Common;
-using Shared.Phone.Device.DeviceLogic;
 using Shared.Phone.UserCenter;
 using System;
 using System.Collections.Generic;
@@ -73,8 +72,8 @@
             //褰╃伅鎺т欢
             this.waveSeekBar = new WaveSeekBar();
             waveSeekBar.Y = Application.GetRealHeight(377);
-            waveSeekBar.Width = Application.GetMinRealAverage(271);
-            waveSeekBar.Height = Application.GetMinRealAverage(533);
+            waveSeekBar.Width = this.GetPictrueRealSize(271);
+            waveSeekBar.Height = this.GetPictrueRealSize(533);
             waveSeekBar.Gravity = Gravity.CenterHorizontal;
             waveSeekBar.WavePadding = Application.GetRealWidth(8);
             waveSeekBar.MaxValue = 100;
@@ -155,7 +154,17 @@
                 //鍙樻洿杩涘害鐧惧垎姣旂殑鏄剧ず
                 btnProgress.Y = progressY + waveSeekBar.NowProgressY;
                 btnProgress.Text = value + "%";
-                nowProgressValue = value;
+                if (Common.Config.Instance.Home.IsVirtually == false)
+                {
+                    nowProgressValue = value;
+                }
+                else
+                {
+                    //濡傛灉浣忓畢涓鸿櫄鎷熶綇瀹�,鐩存帴鏀圭紦瀛�
+                    ((DimmableLight)this.device).Level = value * MaxLevel / 100;
+                    //浜害 XX
+                    this.SetStatuText(Language.StringByID(R.MyInternationalizationString.uBrightness) + "  " + HdlDeviceOtherLogic.Current.GetDeviceStatu(this.device));
+                }
             };
 
             if (this.hadInitControl == true)
@@ -194,6 +203,15 @@
         /// <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(isOpen);
+                return;
+            }
+
             //褰撴寜涓嬪紑鍏虫寜閽椂,涓嶈兘鍐嶅彂閫佽繘搴﹀��
             this.canSetProgressValue = false;
 
@@ -202,44 +220,34 @@
             {
                 HdlThreadLogic.Current.RunMain(() =>
                 {
-                    //娌℃湁鎺ユ敹鍒扮綉鍏冲洖澶�
-                    if (result == false)
+                    bool statu = ((LightBase)this.device).OnOffStatus == 1;
+                    //鎺ユ敹鍒扮綉鍏冲洖澶�
+                    if (result == true)
                     {
-                        bool statu = ((LightBase)this.device).OnOffStatus == 1;
                         //鍒锋柊寮�鍏崇姸鎬�
                         this.RefreshSwitchStatu(statu);
-                        if (statu == true)
-                        {
-                            //绛夊緟缁撴灉缁撴潫鍚�,褰╃伅鎺т欢鍙互婊戝姩
-                            waveSeekBar.IsClickable = true;
-                        }
+                        //鐘舵�佸彇鍙�
+                        listControl[0].IsSelected = statu;
+                    }
+                    if (statu == true)
+                    {
+                        //绛夊緟缁撴灉缁撴潫鍚�,褰╃伅鎺т欢鍙互婊戝姩
+                        waveSeekBar.IsClickable = true;
                     }
                 });
             });
 
-            //鐘舵�佸彇鍙�
-            listControl[0].IsSelected = !listControl[0].IsSelected;
             //鍙戦�佺瓑寰呯殑鏃堕棿鍐�,涓嶈兘婊戝姩褰╃伅鎺т欢
             waveSeekBar.IsClickable = false;
-            if (isOpen == true)
-            {
-                waveSeekBar.SetProgressBarColors(ZigbeeColor.Current.GXCWaveSeekBarColor_Start, ZigbeeColor.Current.GXCWaveSeekBarColor_End);
-            }
-            else
-            {
-                waveSeekBar.SetProgressBarColors(ZigbeeColor.Current.GXCWaveSeekBarUnSelectedColor, ZigbeeColor.Current.GXCWaveSeekBarUnSelectedColor);
-            }
 
             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);
             }
         }
@@ -256,17 +264,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);
                 });
+                return true;
             }
             return false;
         }

--
Gitblit v1.8.0