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/Controls/DeviceCard/DeviceColorTemperatureCardControl.cs |   25 +++++++++++++++++++++++--
 1 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/MainPage/Controls/DeviceCard/DeviceColorTemperatureCardControl.cs b/ZigbeeApp/Shared/Phone/MainPage/Controls/DeviceCard/DeviceColorTemperatureCardControl.cs
index 633c0ff..9406f22 100755
--- a/ZigbeeApp/Shared/Phone/MainPage/Controls/DeviceCard/DeviceColorTemperatureCardControl.cs
+++ b/ZigbeeApp/Shared/Phone/MainPage/Controls/DeviceCard/DeviceColorTemperatureCardControl.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,7 +53,21 @@
                 {
                     //鎵撳紑
                     this.SetDeviceStatuText(Language.StringByID(R.MyInternationalizationString.uOpen1));
-                    i_device.SwitchControl(1);
+                    if (level == 0)
+                    {
+                        //濡傛灉褰撳墠鏄墦寮�鐘舵��,骞朵笖浜害涓�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
                 {
@@ -71,7 +92,7 @@
             {
                 Common.CommonPage.Instance.IsDrawerLockMode = true;
 
-                if (Common.LocalDevice.Current.IsMiniLight(this.device) == false)
+                if (HdlDeviceCommonLogic.Current.IsMiniLight(this.device) == false)
                 {
                     var form = new ControlForm.DeviceColorTemperatureLightDetailCardForm();
                     form.RowOrCardControl = this;

--
Gitblit v1.8.0