From dee21bf452a8979d0515d13e534fbb69ed9715dd Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期二, 01 九月 2020 15:33:13 +0800
Subject: [PATCH] 上传一个版本

---
 ZigbeeApp/Shared/Phone/Category/Controls/DeviceRow/DeviceColorTemperatureRowControl.cs |   27 +++++++++++++++++++++------
 1 files changed, 21 insertions(+), 6 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/Category/Controls/DeviceRow/DeviceColorTemperatureRowControl.cs b/ZigbeeApp/Shared/Phone/Category/Controls/DeviceRow/DeviceColorTemperatureRowControl.cs
index aa7e70f..5f148d0 100755
--- a/ZigbeeApp/Shared/Phone/Category/Controls/DeviceRow/DeviceColorTemperatureRowControl.cs
+++ b/ZigbeeApp/Shared/Phone/Category/Controls/DeviceRow/DeviceColorTemperatureRowControl.cs
@@ -28,11 +28,18 @@
             var btnSwitch = this.AddSwitchControl();
             btnSwitch.ButtonClickEvent += (sender, e) =>
             {
+                //鑾峰彇褰撳墠浜害
+                int level = Convert.ToInt32(i_device.GetType().InvokeMember("Level", System.Reflection.BindingFlags.GetField, null, i_device, null));
                 //濡傛灉浣忓畢涓鸿櫄鎷熶綇瀹�,鐩存帴淇敼缂撳瓨
                 if (Common.Config.Instance.Home.IsVirtually == true)
                 {
                     //鐩存帴鍙樻洿缂撳瓨
                     ((LightBase)i_device).OnOffStatus = btnSwitch.IsSelected == true ? 0 : 1;
+                    if (((LightBase)i_device).OnOffStatus == 1 && level == 0)
+                    {
+                        //濡傛灉褰撳墠鏄墦寮�鐘舵��,骞朵笖浜害涓�0鐨勮瘽,鍒欓渶瑕佸彉鎴�100%浜害
+                        i_device.GetType().InvokeMember("Level", System.Reflection.BindingFlags.SetField, null, i_device, new object[] { 100 });
+                    }
                     this.RefreshControlInfo(this.device);
                     return;
                 }
@@ -46,13 +53,21 @@
                 {
                     //鎵撳紑
                     this.SetDeviceStatuText(Language.StringByID(R.MyInternationalizationString.uOpen1));
-                    i_device.SwitchControl(1);
-                    HdlThreadLogic.Current.RunThread(() =>
+                    if (level == 0)
                     {
-                        //鑾峰彇鐏厜浜害
-                        System.Threading.Thread.Sleep(300);
-                        HdlDeviceAttributeLogic.Current.SendLevelStatuComand(i_device);
-                    });
+                        //濡傛灉褰撳墠鏄墦寮�鐘舵��,骞朵笖浜害涓�0鐨勮瘽,鍒欓渶瑕佸彉鎴�100%浜害
+                        i_device.GetType().InvokeMember("SetLevel", System.Reflection.BindingFlags.InvokeMethod, null, i_device, new object[] { 254 });
+                    }
+                    else
+                    {
+                        i_device.SwitchControl(1);
+                        HdlThreadLogic.Current.RunThread(() =>
+                        {
+                            //鑾峰彇鐏厜浜害
+                            System.Threading.Thread.Sleep(300);
+                            HdlDeviceAttributeLogic.Current.SendLevelStatuComand(i_device);
+                        });
+                    }
                 }
                 else
                 {

--
Gitblit v1.8.0