From b6fdafae7a4d67ea44bbf8cc27563bca3244de4e Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期一, 24 七月 2023 09:19:01 +0800
Subject: [PATCH] 群控更新bug修复

---
 HDL-ON_Android/Properties/AndroidManifest.xml                             |    2 
 HDL_ON/UI/UI2/1-HomePage/HomePage.cs                                      |    3 
 HDL_ON/UI/UI2/FuntionControlView/Light/ColorfulSettingPage.cs             |   20 ++--
 HDL-ON_Android/Assets/Language.ini                                        |   11 +-
 HDL_ON/UI/UI2/2-Classification/SeriesFunctionListPage.cs                  |   28 ++++-
 HDL_ON/UI/UI2/FuntionControlView/Light/ColorfulInfoPage.cs                |    2 
 HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs                      |   38 ++++---
 HDL_ON/UI/UI2/4-PersonalCenter/CombinedDimming/CombinedDimmingListPage.cs |    4 
 HDL-ON_Android/HDL-ON_Android.csproj                                      |    2 
 HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs                                   |   11 ++
 HDL-ON_iOS/Resources/Language.ini                                         |   11 +-
 HDL_ON/UI/UI2/4-PersonalCenter/CombinedDimming/AddGroupControlPage.cs     |   21 ++-
 HDL_ON/UI/UI2/FuntionControlView/Light/GroupControlPage_V2.cs             |  101 +++++++++++++++++--
 HDL_ON/Common/R.cs                                                        |    4 
 14 files changed, 189 insertions(+), 69 deletions(-)

diff --git a/HDL-ON_Android/Assets/Language.ini b/HDL-ON_Android/Assets/Language.ini
index 6871f5f..8a5d59e 100644
--- a/HDL-ON_Android/Assets/Language.ini
+++ b/HDL-ON_Android/Assets/Language.ini
@@ -666,7 +666,7 @@
 679=Group control
 680=Colorful switch
 681=Test
-682=Automatic coloring
+682=Group
 
 
 
@@ -2007,7 +2007,7 @@
 679=缁勬帶
 680=鐐僵寮�鍏�
 681=鑷姩鐐僵娴嬭瘯
-682=鑷姩鐐僵
+682=缇ょ粍
 
 
 
@@ -3347,7 +3347,8 @@
 679=Group control
 680=Colorful switch
 681=Test
-682=Automatic Coloring
+682=Group
+683=
 
 
 
@@ -4683,7 +4684,7 @@
 679=Group control
 680=Colorful switch
 681=Test
-682=Automatic Coloring
+682=Group
 
 
 
@@ -6008,7 +6009,7 @@
 679=Group control
 680=Colorful switch
 681=Test
-682=Automatic Coloring
+682=Group
 
 
 
diff --git a/HDL-ON_Android/HDL-ON_Android.csproj b/HDL-ON_Android/HDL-ON_Android.csproj
index 18122bc..b1ac2e1 100644
--- a/HDL-ON_Android/HDL-ON_Android.csproj
+++ b/HDL-ON_Android/HDL-ON_Android.csproj
@@ -401,7 +401,6 @@
     <AndroidAsset Include="Assets\Phone\LogicIcon\selectlocation.png" />
     <AndroidAsset Include="Assets\Phone\FunctionIcon\Light\ColorfulBar.png" />
     <AndroidAsset Include="Assets\Phone\FunctionIcon\Icon\HomeIcon\groupControl_blue.png" />
-    <AndroidAsset Include="Assets\Phone\FunctionIcon\Icon\HomeIcon\GroupControl_white.png" />
     <AndroidAsset Include="Assets\h5\index.html" />
     <AndroidAsset Include="Assets\h5\static\index.63b34199.css" />
     <AndroidAsset Include="Assets\h5\static\images\coal-save-ic.png" />
@@ -456,6 +455,7 @@
     <AndroidAsset Include="Assets\Phone\FunctionIcon\DoorLock\DoorlockHelpImage4.png" />
     <AndroidAsset Include="Assets\Phone\FunctionIcon\Icon\HorseRaceLampIcon.png" />
     <AndroidAsset Include="Assets\Phone\FunctionIcon\DoorLock\VideoDoorlockBatteryManagementBg.png" />
+    <AndroidAsset Include="Assets\Phone\FunctionIcon\Icon\HomeIcon\groupControl_white.png" />
   </ItemGroup>
   <ItemGroup>
     <AndroidResource Include="Resources\values\colors.xml" />
diff --git a/HDL-ON_Android/Properties/AndroidManifest.xml b/HDL-ON_Android/Properties/AndroidManifest.xml
index 48f8c90..7a7f143 100644
--- a/HDL-ON_Android/Properties/AndroidManifest.xml
+++ b/HDL-ON_Android/Properties/AndroidManifest.xml
@@ -1,5 +1,5 @@
 锘�<?xml version="1.0" encoding="utf-8"?>
-<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.9.0" package="com.hdl.onpro" xmlns:tools="http://schemas.android.com/tools" android:versionCode="202307211">
+<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.9.0" package="com.hdl.onpro" xmlns:tools="http://schemas.android.com/tools" android:versionCode="202307222">
 	<uses-sdk android:minSdkVersion="26" android:targetSdkVersion="29" />
 	<uses-permission android:name="android.permission.RECEIVE_SMS" />
 	<!--鍙嬬洘-->
diff --git a/HDL-ON_iOS/Resources/Language.ini b/HDL-ON_iOS/Resources/Language.ini
index 6871f5f..8a5d59e 100644
--- a/HDL-ON_iOS/Resources/Language.ini
+++ b/HDL-ON_iOS/Resources/Language.ini
@@ -666,7 +666,7 @@
 679=Group control
 680=Colorful switch
 681=Test
-682=Automatic coloring
+682=Group
 
 
 
@@ -2007,7 +2007,7 @@
 679=缁勬帶
 680=鐐僵寮�鍏�
 681=鑷姩鐐僵娴嬭瘯
-682=鑷姩鐐僵
+682=缇ょ粍
 
 
 
@@ -3347,7 +3347,8 @@
 679=Group control
 680=Colorful switch
 681=Test
-682=Automatic Coloring
+682=Group
+683=
 
 
 
@@ -4683,7 +4684,7 @@
 679=Group control
 680=Colorful switch
 681=Test
-682=Automatic Coloring
+682=Group
 
 
 
@@ -6008,7 +6009,7 @@
 679=Group control
 680=Colorful switch
 681=Test
-682=Automatic Coloring
+682=Group
 
 
 
diff --git a/HDL_ON/Common/R.cs b/HDL_ON/Common/R.cs
index 4523120..13a3205 100644
--- a/HDL_ON/Common/R.cs
+++ b/HDL_ON/Common/R.cs
@@ -6,6 +6,10 @@
     {
 
         /// <summary>
+        /// 缇ょ粍锛堣窇椹伅鍒嗙粍锛�
+        /// </summary>
+        public const int HorseRaceLampGroup = 682;
+        /// <summary>
         /// 鑷姩鐐僵娴嬭瘯
         /// </summary>
         public const int CulorfulTest = 681;
diff --git a/HDL_ON/UI/UI2/1-HomePage/HomePage.cs b/HDL_ON/UI/UI2/1-HomePage/HomePage.cs
index 47d6c7c..cf7b7ab 100644
--- a/HDL_ON/UI/UI2/1-HomePage/HomePage.cs
+++ b/HDL_ON/UI/UI2/1-HomePage/HomePage.cs
@@ -915,7 +915,6 @@
                             sceneFunctionView = new VerticalScrolViewLayout();
                             contentView.AddChidren(sceneFunctionView);
                             LoadSceneFunctionControlZone();
-                            contentView.PageIndex = CurShowTypeContent;
                             if (DB_ResidenceData.Instance.HomeGateway.isSupportGroupControl)
                             {
                                 gcFunctionView = new VerticalScrolViewLayout();
@@ -929,6 +928,7 @@
                             GetUnreadPushMessages();
                             RegisterGetPushMessageAction();
 
+                            contentView.PageIndex = CurShowTypeContent;
                             if (waitPage != null)
                             {
                                 waitPage.RemoveFromParent();
@@ -1087,6 +1087,7 @@
         /// </summary>
         void LoadGroupControlFunctionControlZone()
         {
+
             #region ContextView
             gcFunctionView.RemoveAll();
             functionViews.Clear();
diff --git a/HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs b/HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs
index 5b646a5..649b4c8 100644
--- a/HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs
+++ b/HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs
@@ -244,6 +244,12 @@
         {
             if (bodyView != null)
             {
+
+                if (FunctionList.List.groupControls.Count == 0)
+                {
+                    bodyView.loadNavView();
+                    bodyView.contentView.PageIndex = 0;
+                }
                 bodyView.LoadGroupControlFunctionControlZone();
             }
         }
@@ -584,6 +590,11 @@
                     //    }
                     //    Control.Ins.SendWriteCommand(function, d);
                     //}
+                    else if (function.spk == SPK.GroupControl)
+                    {
+                        d.Add("on_off", function.trait_on_off.curValue.ToString());
+                        (function as GroupControl).Control(d);
+                    }
                     else
                     {
                         d.Add("on_off", function.trait_on_off.curValue.ToString());
diff --git a/HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs b/HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs
index 83e733f..85c52d9 100644
--- a/HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs
+++ b/HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs
@@ -672,7 +672,7 @@
                 {
                     case ShowFunction.Series:
                         functionCount = FunctionList.List.GetSeries().Count;
-                        functionOnCount = FunctionList.List.GetSeries().FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count;
+                        //functionOnCount = FunctionList.List.GetSeries().FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count;
                         break;
                     case ShowFunction.IpCam:
                         functionCount = FunctionList.List.GetIpCamImouList().Count;
@@ -844,21 +844,29 @@
                         TextAlignment = TextAlignment.CenterLeft,
                         Text = "/" + functionCount,
                     };
-                    functionView.AddChidren(btnFunctionCount);
-                    Button btnOpenCount = new Button()
+                    if (item == ShowFunction.Series)
                     {
-                        X = Application.GetRealWidth(16),
-                        Y = btnName.Bottom,
-                        Width = Application.GetRealWidth(14 * functionCount.ToString().Length),
-                        Height = Application.GetRealHeight(24),
-                        TextColor = CSS_Color.MainColor,
-                        TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
-                        TextAlignment = TextAlignment.CenterLeft,
-                        Text = functionOnCount.ToString(),
-                        Tag = item + "_onCount",
-                        BorderWidth = 0,
-                    };
-                    functionView.AddChidren(btnOpenCount);
+                        btnFunctionCount.Text = functionCount.ToString();
+                    }
+                    functionView.AddChidren(btnFunctionCount);
+
+                    if (item != ShowFunction.Series)
+                    {
+                        Button btnOpenCount = new Button()
+                        {
+                            X = Application.GetRealWidth(16),
+                            Y = btnName.Bottom,
+                            Width = Application.GetRealWidth(14 * functionCount.ToString().Length),
+                            Height = Application.GetRealHeight(24),
+                            TextColor = CSS_Color.MainColor,
+                            TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
+                            TextAlignment = TextAlignment.CenterLeft,
+                            Text = functionOnCount.ToString(),
+                            Tag = item + "_onCount",
+                            BorderWidth = 0,
+                        };
+                        functionView.AddChidren(btnOpenCount);
+                    }
                 }
 
 
diff --git a/HDL_ON/UI/UI2/2-Classification/SeriesFunctionListPage.cs b/HDL_ON/UI/UI2/2-Classification/SeriesFunctionListPage.cs
index aec513e..e9b11a2 100644
--- a/HDL_ON/UI/UI2/2-Classification/SeriesFunctionListPage.cs
+++ b/HDL_ON/UI/UI2/2-Classification/SeriesFunctionListPage.cs
@@ -5,6 +5,10 @@
 using Shared;
 namespace HDL_ON.UI.UI2.Classification
 {
+    /// <summary>
+    /// 璺戦┈鐏〉闈�
+    /// 搴忓垪椤甸潰
+    /// </summary>
     public class SeriesFunctionListPage : FrameLayout
     {
         FrameLayout bodyView;
@@ -31,19 +35,25 @@
 
             Dictionary<string, List<Button>> dicGroupButtons = new Dictionary<string, List<Button>>();
 
+            List<string> oidList = new List<string>();
+           
             foreach(var rgb in FunctionList.List.GetLightList())
             {
-                if(rgb.spk == SPK.LightRGB)
+                //if(rgb.spk == SPK.LightRGB)
                 {
-                    if (rgb.GetAttribute(FunctionAttributeKey.Colorful) == null)
+                    var oid = rgb.sid.Substring(0, 16);
+                    if (oidList.Contains(oid))
                     {
                         continue;
                     }
-                    List<Button> groupButtons = new List<Button>();
-                    var list = new List<Function>();
-                    list.Add(rgb);
-                    var oid = rgb.sid.Substring(0, 16);
                     var seriesList = FunctionList.List.GetSeries().FindAll((obj) => obj.sid.StartsWith(oid));
+                    if (seriesList.Count == 0)
+                    {
+                        continue;
+                    }
+                    oidList.Add(oid);
+                    var list = new List<Function>();
+                    List<Button> groupButtons = new List<Button>();
                     list.AddRange(seriesList);
                     var groupView = new VerticalScrolViewLayout()
                     {
@@ -66,8 +76,12 @@
                         TextSize = CSS_FontSize.SubheadingFontSize,
                         TextAlignment = TextAlignment.CenterLeft,
                         TextColor = CSS_Color.MainColor,
-                        Text = rgb.name,
+                        Text =Language.StringByID( StringId.HorseRaceLampGroup )+ " "+ oidList.Count.ToString(),
                     };
+                    if(Language.CurrentLanguage == "Chinese")
+                    {
+                        btnTitle.Text = Language.StringByID(StringId.HorseRaceLampGroup) + oidList.Count.ToString();
+                    }
                     titleView.AddChidren(btnTitle);
 
                     #endregion
diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/CombinedDimming/AddGroupControlPage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/CombinedDimming/AddGroupControlPage.cs
index b398d83..b5f70fd 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/CombinedDimming/AddGroupControlPage.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/CombinedDimming/AddGroupControlPage.cs
@@ -92,7 +92,7 @@
             bodyView.BackgroundColor = CSS_Color.BackgroundColor;
             if (isAdd)
             {
-                new TopViewDiv(bodyView, Language.StringByID(StringId.CombinedDimming)).LoadTopView();
+                new TopViewDiv(bodyView, Language.StringByID(StringId.GroupControl)).LoadTopView();
             }
             else
             {
@@ -115,7 +115,8 @@
                                         {
                                             if (pack.Code == StateCode.SUCCESS)
                                             {
-                                                FunctionList.List.groupControls.Remove(groupControl);//var delTemp = FunctionList.List.groupControls.Find((obj) => groupControl.sid == obj.sid);
+                                                var delTemp = FunctionList.List.groupControls.Find((obj) => groupControl.sid == obj.sid);
+                                                FunctionList.List.groupControls.Remove(delTemp);
                                                 //list.Remove(groupControl);
                                                 this.RemoveFromParent();
                                                 delAction?.Invoke();
@@ -478,13 +479,15 @@
                     {
                         try
                         {
-                            var newEditDataString = Newtonsoft.Json.JsonConvert.SerializeObject(this.groupControl);
-                            //娌℃湁鏇存柊鏁版嵁鍒欑洿鎺ラ��鍑�
-                            if (newEditDataString == editDataString)
-                            {
-                                this.RemoveFromParent();
-                                return;
-                            }
+                            //var newEditDataString = Newtonsoft.Json.JsonConvert.SerializeObject(this.groupControl);
+                            //var newEditDataString1 = Newtonsoft.Json.JsonConvert.SerializeObject(groupControlLightList);
+                            //var newEditDataString2 = Newtonsoft.Json.JsonConvert.SerializeObject(this.groupControl.sids);
+                            ////娌℃湁鏇存柊鏁版嵁鍒欑洿鎺ラ��鍑�
+                            //if (newEditDataString == editDataString && newEditDataString1 == newEditDataString2)
+                            //{
+                            //    this.RemoveFromParent();
+                            //    return;
+                            //}
                             groupControl.sids.Clear();
                             foreach (var light in groupControlLightList)
                             {
diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/CombinedDimming/CombinedDimmingListPage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/CombinedDimming/CombinedDimmingListPage.cs
index c4b2d1b..ddba883 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/CombinedDimming/CombinedDimmingListPage.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/CombinedDimming/CombinedDimmingListPage.cs
@@ -21,7 +21,7 @@
         public void LoadPage()
         {
 
-            new TopViewDiv(bodyView, Language.StringByID(StringId.CombinedDimming)).LoadTopView_AddIcon("CombinedDimming",
+            new TopViewDiv(bodyView, Language.StringByID(StringId.GroupControl)).LoadTopView_AddIcon("CombinedDimming",
                 (s,c)=>{
                     try
                     {
@@ -234,6 +234,8 @@
                                         {
                                             if (pack.Code == StateCode.SUCCESS)
                                             {
+                                                var delTemp = FunctionList.List.groupControls.Find((obj) => groupControl.sid == obj.sid);
+                                                FunctionList.List.groupControls.Remove(delTemp);
                                                 list.Remove(groupControl);
                                                 LoadGroupControlView(list);
                                             }
diff --git a/HDL_ON/UI/UI2/FuntionControlView/Light/ColorfulInfoPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Light/ColorfulInfoPage.cs
index c5cee61..c03afbb 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Light/ColorfulInfoPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Light/ColorfulInfoPage.cs
@@ -161,7 +161,7 @@
             btnStartColor.MouseUpEventHandler = (sender, e) => {
                 Action<uint> action = (color) => {
                     btnStartColor.BackgroundColor = color;
-                    function.SetAttrState(FunctionAttributeKey.ColorfulBegin, color);
+                    //function.SetAttrState(FunctionAttributeKey.ColorfulBegin, color);
                 };
                 var rgbView = new ColorfulSettingPage(function, action,true);
                 MainPage.BasePageView.AddChidren(rgbView);
diff --git a/HDL_ON/UI/UI2/FuntionControlView/Light/ColorfulSettingPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Light/ColorfulSettingPage.cs
index 8bb2a15..eaec6ee 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Light/ColorfulSettingPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Light/ColorfulSettingPage.cs
@@ -333,26 +333,26 @@
             btnConfrim.MouseUpEventHandler = (sender, e) =>
             {
                 backAction?.Invoke(curColor) ;
-                System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
+                var d = new System.Collections.Generic.Dictionary<string, string>();
                 if (isSatrtColor)
                 {
                     d.Add(FunctionAttributeKey.ColorfulBegin, redColor + "," + greenColor + "," + blueColor);
                     function.SetAttrState(FunctionAttributeKey.ColorfulBegin, redColor + "," + greenColor + "," + blueColor);
-                    var color = function.GetAttrState(FunctionAttributeKey.ColorfulEnd).Split(",");
-                    var sendColorString = color[0] + "," + color[1] + "," + color[2];
-                    d.Add(FunctionAttributeKey.ColorfulEnd, sendColorString);
-                    d.Add(FunctionAttributeKey.ColorfulTime, function.GetAttrState(FunctionAttributeKey.ColorfulTime));
-
+                    //var color = function.GetAttrState(FunctionAttributeKey.ColorfulEnd).Split(",");
+                    //var sendColorString = color[0] + "," + color[1] + "," + color[2];
+                    //d.Add(FunctionAttributeKey.ColorfulEnd, sendColorString);
+                    //d.Add(FunctionAttributeKey.ColorfulTime, function.GetAttrState(FunctionAttributeKey.ColorfulTime));
                 }
                 else
                 {
-                    var color = function.GetAttrState(FunctionAttributeKey.ColorfulBegin).Split(",");
-                    var sendColorString = color[0] + "," + color[1] + "," + color[2];
-                    d.Add(FunctionAttributeKey.ColorfulBegin, sendColorString);
-                    d.Add(FunctionAttributeKey.ColorfulTime, function.GetAttrState(FunctionAttributeKey.ColorfulTime));
+                    //var color = function.GetAttrState(FunctionAttributeKey.ColorfulBegin).Split(",");
+                    //var sendColorString = color[0] + "," + color[1] + "," + color[2];
+                    //d.Add(FunctionAttributeKey.ColorfulBegin, sendColorString);
+                    //d.Add(FunctionAttributeKey.ColorfulTime, function.GetAttrState(FunctionAttributeKey.ColorfulTime));
                     d.Add(FunctionAttributeKey.ColorfulEnd, redColor + "," + greenColor + "," + blueColor);
                     function.SetAttrState(FunctionAttributeKey.ColorfulEnd, redColor + "," + greenColor + "," + blueColor);
                 }
+                //d.Add(FunctionAttributeKey.Colorful, "off");
                 Control.Ins.SendWriteCommand(function, d);
                 this.RemoveFromParent();
             };
diff --git a/HDL_ON/UI/UI2/FuntionControlView/Light/GroupControlPage_V2.cs b/HDL_ON/UI/UI2/FuntionControlView/Light/GroupControlPage_V2.cs
index b71e0c6..ba10e47 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Light/GroupControlPage_V2.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Light/GroupControlPage_V2.cs
@@ -33,8 +33,15 @@
             }
         }
 
+        public override void RemoveFromParent()
+        {
+            base.RemoveFromParent();
+        }
+
         public void LoadPage(Button btnCollectionIcon, Button btnFunctionNameOut, Button btnFromFloorOut)
         {
+            bodyView.RemoveAll();
+
             btnCollection_Out = btnCollectionIcon;
             btnFunctionName_Out = btnFunctionNameOut;
             btnFromFloor_Out = btnFromFloorOut;
@@ -93,6 +100,7 @@
             //};
 
 
+           
 
             //鍥為��鍒锋柊淇℃伅浜嬩欢
             new TopViewDiv(bodyView, Language.StringByID(StringId.GroupControl)).LoadTopView_SettingIcon( () => {
@@ -104,9 +112,22 @@
                                 {
                                     if (newGC != null)
                                     {
-                                        btnFunctionName.Text = btnFunctionName_Out.Text = function.name;
-                                        function.roomIds = newGC.uids;
-                                        btnFromFloor_Out.Text = btnFromFoorAndRoom.Text = newGC.GetUidListName();
+                                        var localTemp = FunctionList.List.groupControls.Find((obj) => obj.deviceId == newGC.deviceId);
+                                        if(localTemp!= null)
+                                        {
+                                            try
+                                            {
+                                                localTemp.sids = newGC.sids;
+                                                localTemp.name = newGC.name;
+                                                localTemp.roomIds = newGC.roomIds;
+                                                localTemp.uids = newGC.uids;
+                                            }
+                                            catch { }
+                                            function = newGC;
+                                            btnFunctionName_Out.Text = function.name;
+                                            btnFromFloor_Out.Text = function.GetRoomListName();
+                                            LoadPage(btnCollection, btnFunctionName, btnFunctionName);
+                                        }
                                     }
                                 });
                             }
@@ -178,17 +199,14 @@
             }
 
             //灞炴�ц缃尯鍩�
-            var attrView = new VerticalScrolViewLayout()
+            VerticalScrolViewLayout attrView = new VerticalScrolViewLayout()
             {
                 Y = Application.GetRealHeight(52),
                 Width = Application.GetRealWidth(343),
                 ScrollEnabled = false,
             };
-            //灞炴�ц缃尯鍩熼珮搴�
-            int attrViewHight = Application.GetRealHeight(18 + 22);
-
-
             controlView.AddChidren(attrView);
+
             attrView.AddChidren(new Button() { Height = Application.GetRealHeight(18) });
 
             btnSwitch = new Button()
@@ -217,7 +235,6 @@
                     function.Control(d);
                 }
             };
-
 
 
             if (hadRGB)
@@ -267,7 +284,6 @@
                     btnSwitchIcon.IsSelected = btnSwitch.IsSelected;
                 };
             }
-
 
 
 
@@ -369,6 +385,8 @@
                 {
                     dimmerBar.Progress = 0;
                 }
+                btnBrightnessText.Y = ((100 - dimmerBar.Progress) * Application.GetRealHeight(222 - 16) / 100);
+                btnBrightnessText.Text = dimmerBar.Progress + "%";
             };
 
         }
@@ -466,6 +484,8 @@
                 {
                     dimmerBar.Progress = 0;
                 }
+                btnBrightnessText.Y = ((100 - dimmerBar.Progress) * Application.GetRealHeight(222 - 16) / 100);
+                btnBrightnessText.Text = dimmerBar.Progress + "%";
             };
 
             //attrView.AddChidren(new Button() { Height = Application.GetRealHeight(10) });
@@ -722,6 +742,47 @@
             };
             controlView.AddChidren(dimmerBar);
 
+
+            dimmerBar.OnProgressChangedEvent = (sender, e) =>
+            {
+                if (e == 0 && lastBrightness != 0)
+                {
+                    btnSwitch.IsSelected = false;
+                    lastBrightness = 0;
+                }
+                else
+                {
+                    if (lastBrightness == 0)
+                        lastBrightness = e;
+                    btnSwitch.IsSelected = true;
+                }
+                if (e == 0 || e == 100)
+                {
+                    var d = new Dictionary<string, string>();
+                    d.Add(FunctionAttributeKey.Brightness, e.ToString());
+                    function.Control(d);
+                }
+                else
+                {
+                    if (350 < (DateTime.Now - function.refreshTime).TotalMilliseconds)
+                    {
+                        function.refreshTime = DateTime.Now;
+                        new System.Threading.Thread(() =>
+                        {
+                            var d = new Dictionary<string, string>();
+                            d.Add(FunctionAttributeKey.Brightness, e.ToString());
+                            function.Control(d);
+                        })
+                        { IsBackground = true }.Start();
+                    }
+                }
+
+
+                btnBrightnessText.Y = ((100 - dimmerBar.Progress) * Application.GetRealHeight(222 - 16) / 100);
+                btnBrightnessText.Text = dimmerBar.Progress + "%";
+            };
+
+
             var btnMaxValuesText = new Button()
             {
                 X = dimmerBar.Right,
@@ -734,6 +795,17 @@
                 TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
             };
             controlView.AddChidren(btnMaxValuesText);
+
+            btnSwitch.MouseUpEventHandler += (sender, e) => {
+                if (btnSwitch.IsSelected)
+                {
+                    dimmerBar.Progress = 100;
+                }
+                else
+                {
+                    dimmerBar.Progress = 0;
+                }
+            };
             #endregion
 
             int heightMore = 375 - magriHeight-20;
@@ -799,6 +871,7 @@
                 };
                 barColorTemplatrue.MinValue = 27;
                 barColorTemplatrue.MaxValue = 65;
+                barColorTemplatrue.Progress = 38;
                 barColorTemplatrue.ProgressBarColor = 0x00000000;//鍏ㄩ儴閫忔槑
                 barColorTemplatrue.ProgressBarUnEnableColor = 0x00000000;
                 barColorTemplatrue.SeekBarBackgroundColor = 0x00000000;
@@ -845,7 +918,7 @@
                 var btnGradualChangeText = new Button()
                 {
                     X = Application.GetRealWidth(35),
-                    Y = Application.GetRealHeight(375 + heightMore - magriHeight),
+                    Y = hadCCT ? Application.GetRealHeight(375 + heightMore - magriHeight) : Application.GetRealHeight(heightMore+10),
                     Width = Application.GetRealWidth(224),
                     Height = Application.GetRealHeight(21),
                     TextAlignment = TextAlignment.CenterLeft,
@@ -874,9 +947,11 @@
 
                 var barColorful = new FrameLayout()
                 {
-                    X = btnColorfulEdit.Right + Application.GetRealWidth(15+5),
-                    Y = Application.GetRealHeight(412 + heightMore - magriHeight),
+                    X = btnColorfulEdit.Right + Application.GetRealWidth(15 + 5),
                     Width = Application.GetRealWidth(170),
+                    //X = Application.GetRealWidth(35),
+                    //Width = Application.GetRealWidth(170 + 41),
+                    Y = hadCCT ? Application.GetRealHeight(412 + heightMore - magriHeight) : Application.GetRealHeight(heightMore + 50),
                     Height = Application.GetRealHeight(8),
                     BackgroundImagePath = "FunctionIcon/Light/ColorfulBar.png",
                 };

--
Gitblit v1.8.0