From 62d6c4bf6c30da21ccd8245199234c5004117d56 Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期五, 21 四月 2023 13:32:15 +0800 Subject: [PATCH] V1.7.1发布版本 --- HDL_ON/UI/UI2/4-PersonalCenter/CombinedDimming/AddGroupControlPage.cs | 74 ++++++++++++++++++++++++++++++------- 1 files changed, 60 insertions(+), 14 deletions(-) diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/CombinedDimming/AddGroupControlPage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/CombinedDimming/AddGroupControlPage.cs index d82cd54..29127b6 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/CombinedDimming/AddGroupControlPage.cs +++ b/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) { -- Gitblit v1.8.0