wxr
2023-04-21 62d6c4bf6c30da21ccd8245199234c5004117d56
HDL_ON/UI/UI2/4-PersonalCenter/CombinedDimming/AddGroupControlPage.cs
@@ -90,7 +90,7 @@
            var contentView = new FrameLayout()
            {
                Y = Application.GetRealHeight(64),
                Height = Application.GetRealHeight(550),
                Height = Application.GetRealHeight(667-64),
            };
            bodyView.AddChidren(contentView);
@@ -105,7 +105,7 @@
            Button btnGroupNameTitle = new Button()
            {
                X = Application.GetRealWidth(16),
                Width = Application.GetRealWidth(78),
                Width = Application.GetRealWidth(178),
                TextID = StringId.GroupNmae,
                TextAlignment = TextAlignment.CenterLeft,
                TextSize = CSS_FontSize.SubheadingFontSize,
@@ -253,13 +253,13 @@
                TextColor = CSS_Color.FirstLevelTitleColor,
                TextID = StringId.SelectedAll,
            };
            if (groupControlLightList.Count > 0)
            if (groupControlLightList.Count == lightList.Count)
            {
                btnChooseAll.TextID = StringId.Cancel;
            }
            roomFloorChangeView.AddChidren(btnChooseAll);
            btnChooseAll.MouseUpEventHandler = (sender, e) => {
                if (groupControlLightList.Count > 0)
                if (groupControlLightList.Count == lightList.Count)
                {
                    groupControlLightList.Clear();
                    btnChooseAll.TextID = StringId.SelectAll;
@@ -267,11 +267,33 @@
                }
                else
                {
                    groupControlLightList.Clear();
                    groupControlLightList.AddRange(lightList);
                    btnChooseAll.TextID = StringId.Cancel;
                    btnConfrim.IsSelected = true;
                }
                LoadLightRow(lightList);
                for (int i = 0; i < functionListView.ChildrenCount; i++)
                {
                    var view = functionListView.GetChildren(i);
                    if (view.GetType() == typeof(LightRow))
                    {
                        if (view.Tag != null && view.Tag.ToString() == "row")
                        {
                            for (int j = 0; j < (view as FrameLayout).ChildrenCount; j++)
                            {
                                var btn = (view as FrameLayout).GetChildren(j);
                                if (btn.GetType() == typeof(Button))
                                {
                                    if (btn.Tag != null && btn.Tag.ToString() == "ChooseIcon")
                                    {
                                        (btn as Button).IsSelected = groupControlLightList.Count == lightList.Count;
                                    }
                                }
                            }
                        }
                    }
                }
            };
            #endregion
@@ -360,8 +382,8 @@
                                {
                                    try
                                    {
                                        var addTemp = Newtonsoft.Json.JsonConvert.DeserializeObject<GroupControl>(pack.Data.ToString());
                                        FunctionList.List.groupControls.Add(addTemp);
                                        var addTemp = Newtonsoft.Json.JsonConvert.DeserializeObject<List<GroupControl>>(pack.Data.ToString());
                                        FunctionList.List.groupControls.AddRange(addTemp);
                                    }
                                    catch (Exception ex)
                                    {
@@ -413,6 +435,11 @@
                            {
                                if (pack.Code == StateCode.SUCCESS)
                                {
                                    var temp = FunctionList.List.groupControls.Find((obj) => obj.userDeviceGroupControlId == groupControl.userDeviceGroupControlId);
                                    if(temp!= null)
                                    {
                                        temp = groupControl;
                                    }
                                    backActon?.Invoke();
                                    this.RemoveFromParent();
                                }
@@ -484,6 +511,10 @@
                                    groupControl = groupControlTemps[0];
                                    Application.RunOnMainThread(() =>
                                    {
                                        if (groupControl.sids.Count == lightList.Count)
                                        {
                                            btnChooseAll.TextID = StringId.Cancel;
                                        }
                                        LoadLightRow(lightList);
                                    });
                                }
@@ -534,15 +565,16 @@
                            showCount = 0;
                            functionListView.RemoveAll();
                        }
                        int i = 0;
                        foreach (var function in functions)
                        for(var i =0;i<100;i++)
                        //foreach (var function in functions)
                        {
                            i++;
                            if (i > 100)
                            showCount++;
                            if (showCount >= functions.Count)
                            {
                                break;
                            }
                            showCount++;
                            var function = functions[showCount];
                            var functionDiv = new LightRow(function)
                            {
                                Gravity = Gravity.CenterHorizontal,
@@ -550,7 +582,7 @@
                                BorderColor = 0x00FFFFFF,
                                BorderWidth = 1,
                                BackgroundColor = CSS_Color.MainBackgroundColor,
                                Tag = function.spk + function.sid
                                Tag = "row"
                            };
                            functionDiv.AddChidren(new Button()
                            {
@@ -563,7 +595,7 @@
                            Action setAction = () =>
                            {
                                if (groupControlLightList.Count > 0)
                                if (groupControlLightList.Count > 1)
                                {
                                    btnConfrim.IsSelected = true;
                                }
@@ -571,6 +603,20 @@
                                {
                                    btnConfrim.IsSelected = false;
                                }
                                if (groupControlLightList.Count == functions.Count)
                                {
                                    if (!btnChooseAll.IsSelected)
                                    {
                                        btnChooseAll.IsSelected = true;
                                    }
                                }
                                else
                                {
                                    if (btnChooseAll.IsSelected)
                                    {
                                        btnChooseAll.IsSelected = false;
                                    }
                                }
                            };
                            if (groupControl.sids.Find((obj) => obj.sid == function.sid) != null)
                            {