From 1887ea937010ff8caba39622e8246a2802ca02c5 Mon Sep 17 00:00:00 2001
From: wei <kaede@kaededeMacBook-Air.local>
Date: 星期一, 21 十二月 2020 19:40:04 +0800
Subject: [PATCH] 20201221-3

---
 HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPage.cs |   92 ++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 76 insertions(+), 16 deletions(-)

diff --git a/HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPage.cs
index 63f7030..8ce8ad9 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPage.cs
@@ -341,6 +341,13 @@
         {
             //鏁翠釜鐏拌壊鐣岄潰
             var frameBack = new Dialog();
+
+            var dialogBody = new FrameLayout();
+            frameBack.AddChidren(dialogBody);
+            dialogBody.MouseUpEventHandler = (sender, e) => {
+                frameBack.Close();
+            };
+
             frameBack.Show();
 
             //鐧借壊鐨勮儗鏅�(鐢ㄥ浘鐗囨暣鐨�)
@@ -378,12 +385,17 @@
             btnCozyIcon.Width = Application.GetRealWidth(24);
             btnCozyIcon.Height = Application.GetRealWidth(24);
             btnCozyIcon.UnSelectedImagePath = "FunctionIcon/Light/CozyIcon.png";
+            btnCozyIcon.SelectedImagePath = "FunctionIcon/Light/CozyIconOn.png";
             frameWhite.AddChidren(btnCozyIcon);
             btnCozyIcon.MouseUpEventHandler += (sender, e) =>
-            {
+            {
                 barColorTemplatrue.Progress = 27;
-                barColorTemplatrue.SetCustomText(barColorTemplatrue.Progress * 100 + "K");
-                frameBack.Close();
+                light.Attr_CCT.curValue = barColorTemplatrue.Progress * 100;
+                barColorTemplatrue.SetCustomText(light.Attr_CCT.curValue + "K");
+                frameBack.Close();
+                System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
+                d.Add(FunctionAttributeKey.CCT, light.Attr_CCT.curValue.ToString());
+                DriverLayer.Control.Ins.SendWriteCommand(light, d);
             };
             //娓╅Θ 2700k
             var btnCozy = new Button();
@@ -394,11 +406,18 @@
             btnCozy.Text = Language.StringByID(StringId.Cozy) + " 2700K";
             btnCozy.TextSize = CSS_FontSize.TextFontSize;
             btnCozy.TextColor = CSS_Color.FirstLevelTitleColor;
+            btnCozy.SelectedTextColor = CSS_Color.MainColor;
             btnCozy.TextAlignment = TextAlignment.CenterLeft;
             frameWhite.AddChidren(btnCozy);
             btnCozy.MouseUpEventHandler += (sender, e) =>
             {
                 barColorTemplatrue.Progress = 27;
+                light.Attr_CCT.curValue = barColorTemplatrue.Progress * 100;
+                barColorTemplatrue.SetCustomText(light.Attr_CCT.curValue + "K");
+                frameBack.Close();
+                System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
+                d.Add(FunctionAttributeKey.CCT, light.Attr_CCT.curValue.ToString());
+                DriverLayer.Control.Ins.SendWriteCommand(light, d); barColorTemplatrue.Progress = 27;
                 barColorTemplatrue.SetCustomText(barColorTemplatrue.Progress * 100 + "K");
                 frameBack.Close();
             };
@@ -410,12 +429,17 @@
             btnMeetIcon.Width = Application.GetRealWidth(24);
             btnMeetIcon.Height = Application.GetRealWidth(24);
             btnMeetIcon.UnSelectedImagePath = "FunctionIcon/Light/MeetingGuestsIcon.png";
+            btnMeetIcon.SelectedImagePath = "FunctionIcon/Light/MeetingGuestsIconOn.png";
             frameWhite.AddChidren(btnMeetIcon);
             btnMeetIcon.MouseUpEventHandler += (sender, e) =>
-            {
+            {
                 barColorTemplatrue.Progress = 30;
-                barColorTemplatrue.SetCustomText(barColorTemplatrue.Progress * 100 + "K");
-                frameBack.Close();
+                light.Attr_CCT.curValue = barColorTemplatrue.Progress * 100;
+                barColorTemplatrue.SetCustomText(light.Attr_CCT.curValue + "K");
+                frameBack.Close();
+                System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
+                d.Add(FunctionAttributeKey.CCT, light.Attr_CCT.curValue.ToString());
+                DriverLayer.Control.Ins.SendWriteCommand(light, d);
             };
 
             //浼氬 3000k
@@ -427,13 +451,18 @@
             btnMeet.Text = Language.StringByID(StringId.MeetingGuests) + " 3000K";
             btnMeet.TextSize = CSS_FontSize.TextFontSize;
             btnMeet.TextColor = CSS_Color.FirstLevelTitleColor;
+            btnMeet.SelectedTextColor = CSS_Color.MainColor;
             btnMeet.TextAlignment = TextAlignment.CenterLeft;
             frameWhite.AddChidren(btnMeet);
             btnMeet.MouseUpEventHandler += (sender, e) =>
             {
                 barColorTemplatrue.Progress = 30;
-                barColorTemplatrue.SetCustomText(barColorTemplatrue.Progress * 100 + "K");
-                frameBack.Close();
+                light.Attr_CCT.curValue = barColorTemplatrue.Progress * 100;
+                barColorTemplatrue.SetCustomText(light.Attr_CCT.curValue + "K");
+                frameBack.Close();
+                System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
+                d.Add(FunctionAttributeKey.CCT, light.Attr_CCT.curValue.ToString());
+                DriverLayer.Control.Ins.SendWriteCommand(light, d);
             };
 
             //闃呰鍥炬爣
@@ -443,12 +472,17 @@
             btnReadIcon.Width = Application.GetRealWidth(24);
             btnReadIcon.Height = Application.GetRealWidth(24);
             btnReadIcon.UnSelectedImagePath = "FunctionIcon/Light/ReadIcon.png";
+            btnReadIcon.SelectedImagePath = "FunctionIcon/Light/ReadIconOn.png";
             frameWhite.AddChidren(btnReadIcon);
             btnReadIcon.MouseUpEventHandler += (sender, e) =>
-            {
+            {
                 barColorTemplatrue.Progress = 65;
-                barColorTemplatrue.SetCustomText(barColorTemplatrue.Progress * 100 + "K");
-                frameBack.Close();
+                light.Attr_CCT.curValue = barColorTemplatrue.Progress * 100;
+                barColorTemplatrue.SetCustomText(light.Attr_CCT.curValue + "K");
+                frameBack.Close();
+                System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
+                d.Add(FunctionAttributeKey.CCT, light.Attr_CCT.curValue.ToString());
+                DriverLayer.Control.Ins.SendWriteCommand(light, d);
             };
             //闃呰 6500k
             var btnRead = new Button();
@@ -458,15 +492,41 @@
             btnRead.Height = Application.GetRealWidth(24);
             btnRead.Text = Language.StringByID(StringId.Reading) + " 6500K";
             btnRead.TextSize = CSS_FontSize.TextFontSize;
-            btnRead.TextColor = CSS_Color.MainColor;
+            btnRead.TextColor = CSS_Color.FirstLevelTitleColor;
+            btnRead.SelectedTextColor = CSS_Color.MainColor;
             btnRead.TextAlignment = TextAlignment.CenterLeft;
             frameWhite.AddChidren(btnRead);
             btnRead.MouseUpEventHandler += (sender, e) =>
-            {
+            {
                 barColorTemplatrue.Progress = 65;
-                barColorTemplatrue.SetCustomText(barColorTemplatrue.Progress * 100 + "K");
-                frameBack.Close();
-            };
+                light.Attr_CCT.curValue = barColorTemplatrue.Progress * 100;
+                barColorTemplatrue.SetCustomText(light.Attr_CCT.curValue + "K");
+                frameBack.Close();
+                System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
+                d.Add(FunctionAttributeKey.CCT, light.Attr_CCT.curValue.ToString());
+                DriverLayer.Control.Ins.SendWriteCommand(light, d);
+            };
+            btnCozy.IsSelected = false;
+            btnCozyIcon.IsSelected = false;
+            btnMeet.IsSelected = false;
+            btnMeetIcon.IsSelected = false;
+            btnRead.IsSelected = false;
+            btnReadIcon.IsSelected = false;
+            if (light.Attr_CCT.curValue.ToString() == "2700")
+            {
+                btnCozy.IsSelected = true;
+                btnCozyIcon.IsSelected = true;
+            }
+            if (light.Attr_CCT.curValue.ToString() == "3000")
+            {
+                btnMeet.IsSelected = true;
+                btnMeetIcon.IsSelected = true;
+            }
+            if (light.Attr_CCT.curValue.ToString() == "6500")
+            {
+                btnRead.IsSelected = true;
+                btnReadIcon.IsSelected = true;
+            }
         }
 
         /// <summary>

--
Gitblit v1.8.0