From 6d73bf6e816570291865674bef8bce8972e4de3f Mon Sep 17 00:00:00 2001 From: xm <1271024303@qq.com> Date: 星期三, 01 十二月 2021 16:32:57 +0800 Subject: [PATCH] 2021-12-01-01 --- HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControl.cs | 128 ++++++++++++++++++++++++++++-------------- 1 files changed, 84 insertions(+), 44 deletions(-) diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControl.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControl.cs index b8e067e..fea62b3 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControl.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControl.cs @@ -5,22 +5,30 @@ using System.Text; namespace HDL_ON.UI.UI2.PersonalCenter.PirDevice { - public class AddControl:FrameLayout + public class AddControl : FrameLayout { public AddControl() { + Tag = "PirView"; } - - public void Show() { + public void Show(Control control) + { #region 鐣岄潰甯冨眬 + this.BackgroundColor = CSS.CSS_Color.viewMiddle; PirDevice.View.TopView topView = new View.TopView(); topView.topNameBtn.TextID = StringId.zhinengyaokongqi; topView.topIconBtn.Visible = true; topView.topIconBtn.UnSelectedImagePath = "PirIcon/del.png"; this.AddChidren(topView.FLayoutView()); - topView.clickBackBtn.MouseUpEventHandler += (sender, e) => { this.RemoveFromParent(); }; + topView.clickBackBtn.MouseUpEventHandler += (sender, e) => + { + + this.RemoveFromParent(); + + }; + #region 娣诲姞鎸夐挳 FrameLayout addLayout = new FrameLayout { @@ -47,25 +55,26 @@ #endregion FrameLayout frameLayout = new FrameLayout { - Y = Application.GetRealHeight(64+84), - Height = Application.GetRealHeight(667-64-84), + Y = Application.GetRealHeight(64 + 84), + Height = Application.GetRealHeight(667 - 64 - 84-104), Width = Application.GetRealWidth(TextSize.view375), }; this.AddChidren(frameLayout); - #region 淇濆瓨甯冨眬 + #region 淇濆瓨 FrameLayout saveLayout = new FrameLayout { - Y = Application.GetRealHeight(667-104), + Y = Application.GetRealHeight(667 - 104), Height = Application.GetRealHeight(104), Width = Application.GetRealWidth(TextSize.view375), - BackgroundColor= CSS.CSS_Color.viewLine, + BackgroundColor = CSS.CSS_Color.viewLine, }; this.AddChidren(saveLayout); - + saveLayout.SetCornerWithSameRadius(Application.GetRealHeight(24), HDLUtils.RectCornerTopLeft | HDLUtils.RectCornerTopRight); + //鏆傛椂闅愯棌鎺掑簭鍔熻兘 Button paixuBtn = new Button { - Width = Application.GetRealWidth(375-16*2), + Width = Application.GetRealWidth(375 - 16 * 2), Height = Application.GetRealHeight(20), Y = Application.GetRealHeight(12), X = Application.GetRealWidth(16), @@ -73,13 +82,13 @@ TextSize = TextSize.text14, TextColor = CSS.CSS_Color.textTipColor, }; - saveLayout.AddChidren(paixuBtn); + //saveLayout.AddChidren(paixuBtn); Button saveBtn = new Button { Width = Application.GetRealWidth(220), Height = Application.GetRealHeight(44), - Y = paixuBtn.Bottom+ Application.GetRealHeight(12), + Y = paixuBtn.Bottom + Application.GetRealHeight(12), X = Application.GetRealWidth(78), TextID = StringId.save, TextSize = TextSize.text16, @@ -94,44 +103,75 @@ VerticalScrolViewLayout vv = new VerticalScrolViewLayout(); frameLayout.AddChidren(vv); + RefreshView(vv, false, control); + #endregion - int sum = Pir.BuottonList.Count/3+1; - int h = sum * (16 + 44)+104; - int line = 0; - for (int i = 1, j = 0; i <= Pir.BuottonList.Count; i++, j++) + #region 鐣岄潰鐐瑰嚮浜嬩欢 + //鍒犻櫎鐐瑰嚮浜嬩欢 + topView.clickSetBtn.MouseUpEventHandler += (sender, e) => { - var nameObj = Pir.BuottonList[i-1]; - var FLayout = new FrameLayout + topView.clickSetBtn.IsSelected = !topView.clickSetBtn.IsSelected; + if (topView.clickSetBtn.IsSelected) { - Height = Application.GetRealWidth(h), - }; - vv.AddChidren(FLayout); - - var buttonNameBtn = new Button + topView.topIconBtn.UnSelectedImagePath = ""; + topView.topIconBtn.Text = Language.StringByID(StringId.wancheng); + topView.topIconBtn.TextSize = TextSize.text14; + topView.topIconBtn.TextColor = CSS.CSS_Color.textColor; + RefreshView(vv, true, control); + } + else { - Y = Application.GetRealHeight(line*(16 + 44)), - X=Application.GetRealWidth(16+(16+104)*j), - Width = Application.GetRealWidth(104), - Height = Application.GetRealHeight(44), - Text= nameObj.value, - TextSize = TextSize.text16, - TextColor = CSS.CSS_Color.textColor, - TextAlignment = TextAlignment.Center, - Radius = (uint)Application.GetRealHeight(18), - BorderWidth = 1, - BorderColor = CSS.CSS_Color.textCancelColor, - }; - FLayout.AddChidren(buttonNameBtn); - - if (i % 3 == 0) - { - //婊′竴琛岄噸缃甹=0鍊�; - j = -1; - line += 1; + topView.topIconBtn.UnSelectedImagePath = "PirIcon/del.png"; + topView.topIconBtn.Text = ""; + RefreshView(vv, false, control); } - } + + + }; + //娣诲姞鎸夐挳鐐瑰嚮浜嬩欢 + addBtn.MouseUpEventHandler += (sender, e) => + { + AddButton addButton = new AddButton(); + MainPage.BasePageView.AddChidren(addButton); + addButton.Show(control); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + }; + //淇濆瓨鐐瑰嚮浜嬩欢 + saveBtn.MouseUpEventHandler += (sender, e) => + { + //绉婚櫎褰撳墠鐣岄潰 + this.RemoveFromParent(); + //鍙兘涔嬪墠宸茬粡瀛樺湪璇ョ晫闈� + PirMethod.RemoveView("AddControlComplete"); + AddControlComplete addControlComplete = new AddControlComplete(); + MainPage.BasePageView.AddChidren(addControlComplete); + addControlComplete.Show(control, false); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + }; #endregion } + /// <summary> + /// 鍔犺浇鎸夐挳鎺т欢View鐨勬柟娉� + /// </summary> + /// <param name="vv">涓婁笅婊戝姩鎺т欢</param> + /// <param name="if_bool">琛ㄧず鏄惁鏄剧ず鍒犻櫎鍥炬爣</param> + void RefreshView(VerticalScrolViewLayout vv, bool if_bool, Control control) + { + vv.RemoveAll(); + View.Buttons buttons = new View.Buttons(); + buttons.AddButton2(vv, control.status, (obj) => + { + PirMethod.ThreadSend(control, (responsePackNew) => + { + var buttonObj = control.status.Find((c) => c.value == obj.value); + if (buttonObj != null) + { + control.status.Remove(buttonObj); + } + RefreshView(vv, true, control); + }, "鍒犻櫎鎸夐敭", "fram", this, null, obj); + }, if_bool); + } } } -- Gitblit v1.8.0