From 263401d40b2d9d2c1b36a24f33d45c5cb7192518 Mon Sep 17 00:00:00 2001
From: wei <kaede@kaededeMacBook-Air.local>
Date: 星期三, 23 十二月 2020 15:51:54 +0800
Subject: [PATCH] 20201223-6

---
 HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPage.cs |  222 ++++++++++++++++++++++++++++++++++++-------------------
 1 files changed, 144 insertions(+), 78 deletions(-)

diff --git a/HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPage.cs
index 63f7030..881ab91 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPage.cs
@@ -37,7 +37,7 @@
         /// <summary>
         /// 娓愬彉鏃堕棿淇敼
         /// </summary>
-        DiyImageSeekBar barFadeTime;
+        //DiyImageSeekBar barFadeTime;
         /// <summary>
         /// 鑹叉俯鐨勬粦鍔ㄦ帶浠�
         /// </summary>
@@ -141,9 +141,9 @@
             dimmerBar = new WaveSeekBarOn()
             {
                 Gravity = Gravity.CenterHorizontal,
-                Y = Application.GetRealHeight(74 + 16),
-                Width = Application.GetRealWidth(142 - 40),
-                Height = Application.GetRealHeight(222 - 16 - 16),
+                Y = Application.GetRealHeight(108),
+                Width = Application.GetRealWidth(142 - 16 -16),
+                Height = Application.GetRealHeight(222),
                 BorderColor = 0x00000000,
                 CornerRadius = Application.GetRealWidth(20),
                 BorderWidth = 0,
@@ -177,7 +177,7 @@
             //鑹叉俯
             var btnTempClolor = new Button();
             btnTempClolor.X = Application.GetRealWidth(35);
-            btnTempClolor.Y = Application.GetRealHeight(306);
+            btnTempClolor.Y = Application.GetRealHeight(306 +60);
             btnTempClolor.Width = Application.GetRealWidth(224);
             btnTempClolor.Height = Application.GetRealHeight(21);
             btnTempClolor.TextAlignment = TextAlignment.CenterLeft;
@@ -239,63 +239,63 @@
             #endregion
 
             #region 娓愬彉鏃堕棿璋冭妭
-            var btnGradualChangeText = new Button()
-            {
-                X = Application.GetRealWidth(35),
-                Y = Application.GetRealHeight(385),
-                Width = Application.GetRealWidth(224),
-                Height = Application.GetRealHeight(21),
-                TextAlignment = TextAlignment.CenterLeft,
-                TextColor = CSS_Color.FirstLevelTitleColor,
-                TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
-                TextID = StringId.SpeedOfChange,
-            };
-            controlView.AddChidren(btnGradualChangeText);
+            //var btnGradualChangeText = new Button()
+            //{
+            //    X = Application.GetRealWidth(35),
+            //    Y = Application.GetRealHeight(385),
+            //    Width = Application.GetRealWidth(224),
+            //    Height = Application.GetRealHeight(21),
+            //    TextAlignment = TextAlignment.CenterLeft,
+            //    TextColor = CSS_Color.FirstLevelTitleColor,
+            //    TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
+            //    TextID = StringId.SpeedOfChange,
+            //};
+            //controlView.AddChidren(btnGradualChangeText);
 
-            var btnGradualChangeMinValuesText = new Button()
-            {
-                X = Application.GetRealWidth(35),
-                Y = btnGradualChangeText.Bottom + Application.GetRealHeight(8),
-                Width = Application.GetRealWidth(22),
-                Height = Application.GetRealHeight(21),
-                Text = "0s",
-                TextAlignment = TextAlignment.CenterLeft,
-                TextColor = CSS_Color.PromptingColor1,
-                TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
-            };
-            controlView.AddChidren(btnGradualChangeMinValuesText);
+            //var btnGradualChangeMinValuesText = new Button()
+            //{
+            //    X = Application.GetRealWidth(35),
+            //    Y = btnGradualChangeText.Bottom + Application.GetRealHeight(8),
+            //    Width = Application.GetRealWidth(22),
+            //    Height = Application.GetRealHeight(21),
+            //    Text = "0s",
+            //    TextAlignment = TextAlignment.CenterLeft,
+            //    TextColor = CSS_Color.PromptingColor1,
+            //    TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
+            //};
+            //controlView.AddChidren(btnGradualChangeMinValuesText);
 
-            barFadeTime = new DiyImageSeekBar()
-            {
-                X = btnGradualChangeMinValuesText.Right,
-                Y = Application.GetRealHeight(412 - 21) + Application.GetRealHeight(8),
-                Width = Application.GetRealWidth(210),
-                Height = Application.GetRealHeight(54),
-                SeekBarViewHeight = Application.GetRealHeight(8),
-                ThumbImagePath = "Public/ThumbImage.png",
-                ThumbImageHeight = Application.GetRealHeight(54),
-                ProgressBarColor = CSS_Color.MainColor,
-                ProgressTextColor = CSS_Color.FirstLevelTitleColor,
-                ProgressTextSize = CSS_FontSize.PromptFontSize_FirstLevel,
-                ProgressBarUnitSring = "s",
-                MaxValue = 10,
-                Progress = light.fadeTime,
-                SeekBarPadding = Application.GetRealWidth(20),
-            };
-            controlView.AddChidren(barFadeTime);
+            //barFadeTime = new DiyImageSeekBar()
+            //{
+            //    X = btnGradualChangeMinValuesText.Right,
+            //    Y = Application.GetRealHeight(412 - 21) + Application.GetRealHeight(8),
+            //    Width = Application.GetRealWidth(210),
+            //    Height = Application.GetRealHeight(54),
+            //    SeekBarViewHeight = Application.GetRealHeight(8),
+            //    ThumbImagePath = "Public/ThumbImage.png",
+            //    ThumbImageHeight = Application.GetRealHeight(54),
+            //    ProgressBarColor = CSS_Color.MainColor,
+            //    ProgressTextColor = CSS_Color.FirstLevelTitleColor,
+            //    ProgressTextSize = CSS_FontSize.PromptFontSize_FirstLevel,
+            //    ProgressBarUnitSring = "s",
+            //    MaxValue = 10,
+            //    Progress = light.fadeTime,
+            //    SeekBarPadding = Application.GetRealWidth(20),
+            //};
+            //controlView.AddChidren(barFadeTime);
 
-            var btnGradualChangeMaxValuesText = new Button()
-            {
-                X = barFadeTime.Right,
-                Y = btnGradualChangeText.Bottom + Application.GetRealHeight(8),
-                Width = Application.GetRealWidth(35),
-                Height = Application.GetRealHeight(21),
-                Text = "10s",
-                TextAlignment = TextAlignment.CenterLeft,
-                TextColor = CSS_Color.PromptingColor1,
-                TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
-            };
-            controlView.AddChidren(btnGradualChangeMaxValuesText);
+            //var btnGradualChangeMaxValuesText = new Button()
+            //{
+            //    X = barFadeTime.Right,
+            //    Y = btnGradualChangeText.Bottom + Application.GetRealHeight(8),
+            //    Width = Application.GetRealWidth(35),
+            //    Height = Application.GetRealHeight(21),
+            //    Text = "10s",
+            //    TextAlignment = TextAlignment.CenterLeft,
+            //    TextColor = CSS_Color.PromptingColor1,
+            //    TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
+            //};
+            //controlView.AddChidren(btnGradualChangeMaxValuesText);
             #endregion
 
             btnSwitch = new Button()
@@ -314,9 +314,9 @@
             btnShortcut = new Button();
             btnShortcut.X = Application.GetRealWidth(104);
             btnShortcut.Y = btnSwitch.Y;
-            btnShortcut.Width = Application.GetRealWidth(40);
-            btnShortcut.Height = Application.GetRealWidth(40);
-            btnShortcut.UnSelectedImagePath = "FunctionIcon/Light/ColorTemperatrueQuick.png";
+            btnShortcut.Width = Application.GetRealWidth(36);
+            btnShortcut.Height = Application.GetRealWidth(36);
+            btnShortcut.UnSelectedImagePath = "FunctionIcon/Light/CozyIconOn.png";
             controlView.AddChidren(btnShortcut);
             btnShortcut.MouseUpEventHandler += (sender, e) =>
             {
@@ -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,18 @@
             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);
+                btnShortcut.UnSelectedImagePath = "FunctionIcon/Light/CozyIconOn.png";
             };
             //娓╅Θ 2700k
             var btnCozy = new Button();
@@ -394,13 +407,21 @@
             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();
+                btnShortcut.UnSelectedImagePath = "FunctionIcon/Light/CozyIconOn.png";
             };
 
             //浼氬鍥炬爣
@@ -410,12 +431,18 @@
             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);
+                btnShortcut.UnSelectedImagePath = "FunctionIcon/Light/MeetingGuestsIconOn.png";
             };
 
             //浼氬 3000k
@@ -427,13 +454,19 @@
             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);
+                btnShortcut.UnSelectedImagePath = "FunctionIcon/Light/MeetingGuestsIconOn.png";
             };
 
             //闃呰鍥炬爣
@@ -443,12 +476,18 @@
             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);
+                btnShortcut.UnSelectedImagePath = "FunctionIcon/Light/ReadIconOn.png";
             };
             //闃呰 6500k
             var btnRead = new Button();
@@ -458,15 +497,42 @@
             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);
+                btnShortcut.UnSelectedImagePath = "FunctionIcon/Light/ReadIconOn.png";
+            };
+            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