From b2a498cb445dc28d09c07e6c57eb298e3c7f7b16 Mon Sep 17 00:00:00 2001 From: Davin <591807572@qq.com> Date: 星期二, 25 七月 2023 20:26:45 +0800 Subject: [PATCH] feature 导航栏展示问题 --- HDL_ON/UI/UI2/4-PersonalCenter/CombinedDimming/AddGroupControlPage.cs | 106 +++++++++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 94 insertions(+), 12 deletions(-) diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/CombinedDimming/AddGroupControlPage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/CombinedDimming/AddGroupControlPage.cs index b90288d..3d6cb2f 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/CombinedDimming/AddGroupControlPage.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/CombinedDimming/AddGroupControlPage.cs @@ -2,6 +2,7 @@ using System; using System.Collections.Generic; using System.Threading; +using HDL_ON.Common; using HDL_ON.DAL.Server; using HDL_ON.DriverLayer; using HDL_ON.Entity; @@ -50,7 +51,8 @@ /// <summary> /// 鍥炶皟鍒锋柊 /// </summary> - Action backActon; + Action<GroupControl> addActon; + Action delAction; /// <summary> /// 鏄惁鏂板缇ゆ帶 /// </summary> @@ -64,7 +66,7 @@ GroupControlType groupControlType = new GroupControlType(); - public AddGroupControlPage(GroupControl groupControl, Action action) + public AddGroupControlPage(GroupControl groupControl, Action<GroupControl> addAction,Action delAction) { bodyView = this; if(groupControl == null) @@ -78,15 +80,81 @@ editDataString = Newtonsoft.Json.JsonConvert.SerializeObject(this.groupControl); } groupControlLightList = new List<Function>(); - backActon = action; + this.addActon = addAction; + + this.delAction = delAction; + lightList = FunctionList.List.GetLightList(); } public void LoadPage() { bodyView.BackgroundColor = CSS_Color.BackgroundColor; - new TopViewDiv(bodyView, Language.StringByID(StringId.CombinedDimming)).LoadTopView(); + if (isAdd) + { + new TopViewDiv(bodyView, Language.StringByID(StringId.CombinedDimming)).LoadTopView(); + } + else + { + new TopViewDiv(bodyView, "").LoadTopView_SettingText(()=> { + Action action = () => { + var waitPage = new Loading(); + this.AddChidren(waitPage); + waitPage.Start(""); + new System.Threading.Thread(() => + { + try + { + var pack = ApiUtlis.Ins.HttpRequest.DelGroupControl(groupControl.userDeviceGroupControlId); + if (pack != null) + { + Application.RunOnMainThread(() => + { + try + { + if (pack.Code == StateCode.SUCCESS) + { + FunctionList.List.groupControls.Remove(groupControl); + //list.Remove(groupControl); + this.RemoveFromParent(); + delAction?.Invoke(); + } + else + { + IMessageCommon.Current.ShowErrorInfoAlter(pack.Code); + } + } + catch (Exception ex) + { + MainPage.Log($"鍒锋柊缁勬帶鏁版嵁寮傚父:{ex.Message}"); + } + }); + } + } + catch (Exception ex) + { + MainPage.Log($"鍒犻櫎缁勬帶寮傚父:{ex.Message}"); + } + finally + { + Application.RunOnMainThread(() => { + if (waitPage != null) + { + waitPage.Hide(); + waitPage.RemoveFromParent(); + waitPage = null; + } + }); + } + }) + { IsBackground = true }.Start(); + + }; + new PublicAssmebly().TipOptionMsg(StringId.Tip, StringId.DoYouWantDelCombinedDimming, action); + + }, Language.StringByID(StringId.DelGroupControl),true); + } var contentView = new FrameLayout() { Y = Application.GetRealHeight(64), @@ -182,6 +250,7 @@ Action chooseRoomBackAction = () => { try { + groupControl.uids = groupControl.roomIds; btnLocationValues.Text = groupControl.GetRoomListName(); } catch { } @@ -383,13 +452,15 @@ try { var addTemp = Newtonsoft.Json.JsonConvert.DeserializeObject<List<GroupControl>>(pack.Data.ToString()); - FunctionList.List.groupControls.AddRange(addTemp); + if (addTemp != null && addTemp.Count > 0) + groupControl.userDeviceGroupControlId = addTemp[0].userDeviceGroupControlId; + FunctionList.List.groupControls.Add(groupControl); } catch (Exception ex) { - MainPage.Log($"娣诲姞缇ゆ帶鎴愬姛锛岃浆璇戣繑鍥炴暟鎹け璐�:{ex.Message}"); + MainPage.Log($"娣诲姞缇ゆ帶寮傚父锛岃浆璇戣繑鍥炴暟鎹け璐�:{ex.Message}"); } - backActon?.Invoke(); + addActon?.Invoke(groupControl); this.RemoveFromParent(); } else @@ -440,7 +511,7 @@ { temp = groupControl; } - backActon?.Invoke(); + addActon?.Invoke(temp); this.RemoveFromParent(); } else @@ -478,6 +549,12 @@ var groupControlTypes = Newtonsoft.Json.JsonConvert.DeserializeObject<List<GroupControlType>>(pack.Data.ToString()); if (groupControlTypes != null && groupControlTypes.Count > 0) { + //groupControlType = new GroupControlType { + // type = "LIGHT", + // typeName ="鐏厜鎺у埗", + // spks = new List<string> { "light.switch" }, + // spkAttrs = new List<string> { "on_off" } + //}; groupControlType = groupControlTypes[0]; Application.RunOnMainThread(() => { LoadLightRow(lightList); @@ -542,7 +619,7 @@ /// <summary> /// 鏄剧ず鐨勮澶囩殑鎬绘暟 /// </summary> - int showCount = 0; + int showCount = -1; /// <summary> /// 鍔犺浇鍔熻兘row @@ -562,7 +639,7 @@ { if (!isAppend) { - showCount = 0; + showCount = -1; functionListView.RemoveAll(); } for(var i =0;i<100;i++) @@ -603,7 +680,7 @@ { btnConfrim.IsSelected = false; } - if (groupControlLightList.Count == functions.Count) + if (groupControlLightList.Count != functions.Count) { btnChooseAll.TextID = StringId.SelectedAll; } @@ -675,8 +752,12 @@ var form = new FloorRoomSelectPopupView(); form.ShowDeviceFunctionView(btnFloor, this.lightList, (selectId, listFunc) => { + groupControlLightList.Clear(); + groupControl.sids.Clear(); + btnChooseAll.TextID = StringId.SelectAll; + btnConfrim.IsSelected = false; btnChooseAll.MouseUpEventHandler = (sender2, e2) => { - if (groupControlLightList.Count > 0) + if (groupControlLightList.Count == listFunc.Count) { groupControlLightList.Clear(); btnChooseAll.TextID = StringId.SelectAll; @@ -684,6 +765,7 @@ } else { + groupControlLightList.Clear(); groupControlLightList.AddRange(listFunc); btnChooseAll.TextID = StringId.Cancel; btnConfrim.IsSelected = true; -- Gitblit v1.8.0