From 4975f3d6beb81e3967b1018d629be9c3410b9ea3 Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期四, 25 三月 2021 15:43:34 +0800 Subject: [PATCH] Merge branch 'WJC' into temp-wxr --- HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/SetPir.cs | 21 - HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddButton.cs | 36 ++- HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControl.cs | 132 +------------ HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControlComplete.cs | 72 ++++--- HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/EditControl.cs | 1 HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirMain.cs | 8 HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Pir.cs | 2 HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Matching.cs | 49 ----- HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/Buttons.cs | 77 ++++++++ HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs | 127 +++++++++++++ 10 files changed, 282 insertions(+), 243 deletions(-) diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddButton.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddButton.cs index ed65648..01a45e5 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddButton.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddButton.cs @@ -12,13 +12,17 @@ } public void Show(Control control) { - + #region 鐣岄潰甯冨眬 this.BackgroundColor = CSS.CSS_Color.viewMiddle; PirDevice.View.TopView topView = new View.TopView(); topView.topNameBtn.TextID = StringId.tianjiayaokongqi; this.AddChidren(topView.FLayoutView()); - topView.clickBackBtn.MouseUpEventHandler += (sender, e) => { this.RemoveFromParent(); }; + topView.clickBackBtn.MouseUpEventHandler += (sender, e) => + { + + RemoveFromParent(); + }; FrameLayout editfLayout = new FrameLayout { @@ -146,18 +150,8 @@ } //绉婚櫎娣诲姞鎸夐挳鐣岄潰 this.RemoveFromParent(); - - for (int i = MainPage.BasePageView.ChildrenCount - 1; 0 <= i; i--) - { - var view = MainPage.BasePageView.GetChildren(i); - if (view.GetType() == typeof(AddControl)) - { - //鎵惧埌绉婚櫎 - view.RemoveFromParent(); - } - - } - + //绉婚櫎涔嬪墠鍙兘瀛樺湪鐨勭晫闈� + Method.RemoveView("AddControl"); //鍔犺浇鏁版嵁鐣岄潰 AddControl addControl = new AddControl(); MainPage.BasePageView.AddChidren(addControl); @@ -167,8 +161,8 @@ else { replication.RemView(); - new TipPopView().FlashingBox(Language.StringByID(StringId.tianjiashibai)); - + Method method = new Method(); + method.ErrorShow(null,"娣诲姞澶辫触"); } }); @@ -176,6 +170,14 @@ } - + /// <summary> + /// 绉婚櫎鐣岄潰 + /// </summary> + public override void RemoveFromParent() + { + //鍒锋柊鎸囧畾鐣岄潰 + Method.RefreshView("PirMain"); + base.RemoveFromParent(); + } } } diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControl.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControl.cs index 47a0357..b10aae1 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControl.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControl.cs @@ -24,7 +24,7 @@ this.AddChidren(topView.FLayoutView()); topView.clickBackBtn.MouseUpEventHandler += (sender, e) => { - + this.RemoveFromParent(); }; @@ -71,7 +71,7 @@ }; this.AddChidren(saveLayout); saveLayout.SetCornerWithSameRadius(Application.GetRealHeight(24), HDLUtils.RectCornerTopLeft | HDLUtils.RectCornerTopRight); - + //鏆傛椂闅愯棌鎺掑簭鍔熻兘 Button paixuBtn = new Button { Width = Application.GetRealWidth(375 - 16 * 2), @@ -82,7 +82,7 @@ TextSize = TextSize.text14, TextColor = CSS.CSS_Color.textTipColor, }; - saveLayout.AddChidren(paixuBtn); + //saveLayout.AddChidren(paixuBtn); Button saveBtn = new Button { @@ -140,20 +140,13 @@ //淇濆瓨鐐瑰嚮浜嬩欢 saveBtn.MouseUpEventHandler += (sender, e) => { - //绉婚櫎褰撳墠鐣岄潰 + //绉婚櫎褰撳墠鐣岄潰 this.RemoveFromParent(); //鍙兘涔嬪墠宸茬粡瀛樺湪璇ョ晫闈� - for (int i = MainPage.BasePageView.ChildrenCount - 1; 0 <= i; i--) - { - var view = MainPage.BasePageView.GetChildren(i); - if (view.GetType() == typeof(AddControlComplete)) - { - view.RemoveFromParent(); - } - } + Method.RemoveView("AddControlComplete"); AddControlComplete addControlComplete = new AddControlComplete(); MainPage.BasePageView.AddChidren(addControlComplete); - addControlComplete.Show(control,false); + addControlComplete.Show(control, false); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; }; #endregion @@ -166,112 +159,19 @@ void RefreshView(VerticalScrolViewLayout vv, bool if_bool, Control control) { vv.RemoveAll(); - //瀹氫箟涓�涓彉閲忚褰曡鏁� - int sum = 0; - if (control.status.Count % 3 == 0) + View.Buttons buttons = new View.Buttons(); + buttons.AddButton2(vv, control.status, (obj) => { - sum = control.status.Count / 3; - } - else - { - sum = control.status.Count / 3 + 1; - } - //璁$畻鍔犺浇鍑烘潵鐨勬暟鎹渶瑕佺殑楂樺害 - int h = 16 + sum * (16 + 44) + 104 + 76; - int line = 0; - //鎸夐挳鐨勭埗鎺т欢 - var FLayout = new FrameLayout - { - Height = Application.GetRealWidth(h), - }; - vv.AddChidren(FLayout); - for (int i = 1, j = 0; i <= control.status.Count; i++, j++) - { - var nameObj = control.status[i - 1]; - //鎸夐挳 - var buttonNameBtn = new Button + Method.ThreadSend(control, (responsePackNew) => { - - Y = Application.GetRealHeight(16 + 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); - //鍒犻櫎鍥炬爣 - var delIconBtn = new Button - { - UnSelectedImagePath = "PirIcon/delbuton.png", - Y = Application.GetRealHeight(12 + line * (16 + 44)), - X = Application.GetRealWidth((16 + 92) + (104 + 16) * j), - Width = Application.GetRealWidth(16), - Height = Application.GetRealWidth(16), - Tag = nameObj, - }; - if (if_bool) - { - FLayout.AddChidren(delIconBtn); - } - //鍒犻櫎鍥炬爣鐨勭偣鍑讳簨浠� - delIconBtn.MouseUpEventHandler += (sender, e) => - { - var obj = delIconBtn.Tag as Entity.AttributesStatus; - //鍔犺浇log - Loading loading = new Loading(); - this.AddChidren(loading); - HDL_ON.DAL.Server.ResponsePackNew responsePackNew = null; - loading.Start(); - new System.Threading.Thread(() => + var buttonObj = control.status.Find((c) => c.value == obj.value); + if (buttonObj != null) { - try - { - //鍙戦�佹寜閿垹闄わ紱 - responsePackNew = PirSend.CodeRemove(obj, control.deviceId); - } - catch { } - finally - { - Application.RunOnMainThread(() => - { - loading.Hide(); - if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "") - { - var buttonObj = control.status.Find((c) => c.value == obj.value); - if (buttonObj != null) - { - control.status.Remove(buttonObj); - } - RefreshView(vv, true, control); - } - else { - Method method = new Method(); - method.ErrorShow(responsePackNew,""); - } - - }); - } - - }) - { IsBackground = true }.Start(); - - - }; - if (i % 3 == 0) - { - //婊′竴琛岄噸缃甹=0鍊�; - j = -1; - line += 1; - } - - } - + control.status.Remove(buttonObj); + } + RefreshView(vv, true, control); + }, "鍒犻櫎鎸夐敭", "fram", this, null, obj); + }, if_bool); } } } diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControlComplete.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControlComplete.cs index 2b35cc8..ba1829d 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControlComplete.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControlComplete.cs @@ -12,26 +12,12 @@ } public void Show(Control control, bool bool_library) { - //鏁版嵁杞崲 - Entity.Function function = new Entity.Function(); - { - function.sid = control.sid; - function.deviceId = control.deviceId; - function.name = control.name; - function.spk = control.spk; - //function.attributes.AddRange(control.status); - //閬ユ帶鍣ㄦ坊鍔犲埌鍒楄〃锛� - if (null == Pir.currPir.FunctioList.Find((c) => c.sid == function.sid)) - { - Pir.currPir.FunctioList.Add(function); - } - } #region 鐣岄潰甯冨眬 this.BackgroundColor = CSS.CSS_Color.viewMiddle; PirDevice.View.TopView topView = new View.TopView(); topView.topNameBtn.TextID = StringId.tianjiayaokongqi; this.AddChidren(topView.FLayoutView()); - topView.clickBackBtn.MouseUpEventHandler += (sender, e) => { this.RemoveFromParent(); }; + topView.clickBackBtn.MouseUpEventHandler += (sender, e) => { RemoveFromParent(); }; FrameLayout fLayout = new FrameLayout { @@ -41,7 +27,7 @@ Width = Application.GetRealWidth(375), }; this.AddChidren(fLayout); - // + //鎴愬姛鍥炬爣 Button iconBtn = new Button { Y = Application.GetRealHeight(28), @@ -96,7 +82,7 @@ quyuPatchView.frameLayout.Y = namePatchView.frameLayout.Bottom; this.AddChidren(quyuPatchView.FLayoutView()); quyuPatchView.btnText1.TextID = StringId.suoshuquyu; - quyuPatchView.btnText2.Text = Intelligence.Automation.LogicMethod.GetGetRoomName(function); + quyuPatchView.btnText2.Text = Intelligence.Automation.LogicMethod.GetGetRoomName(GetFunction(control.deviceId)); //缁х画娣诲姞 Button addBtn = new Button @@ -124,17 +110,23 @@ List<string> list = new List<string>(); for (int i = 0; i < Pir.currPir.FunctioList.Count; i++) { + //娣诲姞鎵�鏈夐仴鎺у悕绉板垪琛� list.Add(Pir.currPir.FunctioList[i].name); } Method method = new Method(); method.EditControlName(StringId.editName, list, control.name, (name, dialog) => { + //鍙戦�佹洿鏂板悕绉板懡浠� Method.ThreadSend(new Control { deviceId = control.deviceId, name = name }, (responsePackNew) => { + //鍏抽棴绐楀彛 dialog.Close(); + //鏇存柊澶囨敞 namePatchView.btnText2.Text = name; - function.name = name; - + //鏇存柊涓存椂璁惧鍚嶇О + control.name = name; + //鏇存崲鍐呭瓨璁惧鍚嶇О + GetFunction(control.deviceId).name = name; }, "淇敼鍚嶇О", "dialog", null, dialog); }, () => { }); }; @@ -142,22 +134,22 @@ quyuPatchView.btnClick.MouseUpEventHandler += (sender, e) => { Method method = new Method(); - method.ManagementPosition(function, () => + method.ManagementPosition(GetFunction(control.deviceId), () => { //鏇存柊鍖哄煙 - quyuPatchView.btnText2.Text = Intelligence.Automation.LogicMethod.GetGetRoomName(function); + quyuPatchView.btnText2.Text = Intelligence.Automation.LogicMethod.GetGetRoomName(GetFunction(control.deviceId)); }); }; //缁х画娣诲姞鐐瑰嚮浜嬩欢 addBtn.MouseUpEventHandler += (sender, e) => { if (bool_library) - { + {//缁х画娣诲姞搴撶殑閬ユ帶鍣� + Method.RefreshView("PirMain");//鍒锋柊鎸囩偣鐣岄潰 this.RemoveFromParent(); - RefreshView(); } else - { + {//缁х画娣诲姞鑷畾涔夌殑閬ユ帶鍣� Method method = new Method(); method.AddControl(this, (controlDevice) => { @@ -171,26 +163,36 @@ //瀹屾垚鐐瑰嚮浜嬩欢 saveView.btnClick.MouseUpEventHandler += (sender, e) => { + //鍒锋柊鎸囩偣鐣岄潰 + Method.RefreshView("PirMain"); //绉婚櫎鎵�鏈夌晫闈� MainPage.BasePageView.RemoveViewByTag("PirView"); - RefreshView(); - }; #endregion } /// <summary> - /// 鍒锋柊绾㈠瀹濅富鐣岄潰 + /// 鏌ユ壘璁惧瀵硅薄 /// </summary> - void RefreshView() + /// <param name="deviceId">璁惧ID</param> + /// <returns></returns> + public Entity.Function GetFunction(string deviceId) { + var fun = Pir.currPir.FunctioList.Find((c) => c.deviceId == deviceId); + if (fun != null) + { + return fun; + } + return new Entity.Function(); + } - //绉婚櫎绾㈠瀹濇牴鐣岄潰 - MainPage.BasePageView.RemoveViewByTag("PirMain"); - //閲嶆柊鍔犺浇鐣岄潰 - var page = new PirMain(); - MainPage.BasePageView.AddChidren(page); - page.Show(); - MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + /// <summary> + /// 绉婚櫎鐣岄潰 + /// </summary> + public override void RemoveFromParent() + { + //鍒锋柊鎸囧畾鐣岄潰 + Method.RefreshView("PirMain"); + base.RemoveFromParent(); } } } diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/EditControl.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/EditControl.cs index 87b8d69..09c130c 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/EditControl.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/EditControl.cs @@ -9,6 +9,7 @@ { public EditControl() { + Tag = "PirView"; } public void Show(Entity.Function control,Action<Entity.Function> action) { diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Matching.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Matching.cs index bb2af77..1a97eef 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Matching.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Matching.cs @@ -180,10 +180,10 @@ //娴嬭瘯Text testBtn.MouseUpEventHandler += (sender, e) => { - var library = libraryList[index-1]; + var library = libraryList[index - 1]; var control = GetControl(spk, testBtn.TextID, library); //鍙戦�佹祴璇曠爜鍛戒护 - CodeTest(control); + Method.ThreadSend(control, (responsePackNew) => { }, "搴撶爜娴嬭瘯", "frame", this, null); if (code == 3) { //鏍囪鏈�鍚庨偅涓爜 if_bool = true; @@ -218,12 +218,12 @@ var control = GetControl(spk, testBtn.TextID, library); Method method = new Method(); //鍙戦�佸簱娣诲姞閬ユ帶鍣ㄥ懡浠� - method.ThreadAddControl(control, this, (cont) => + method.ThreadAddControl(control, this, (device) => { MainPage.BasePageView.RemoveViewByTag("PirView"); AddControlComplete addControlComplete = new AddControlComplete(); MainPage.BasePageView.AddChidren(addControlComplete); - addControlComplete.Show(cont, true); + addControlComplete.Show(device, true); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; }); @@ -316,47 +316,6 @@ } return control; - } - - /// <summary> - /// 鍙戦�佸簱鐮佹祴璇曞懡浠� - /// </summary> - /// <param name="control"></param> - private void CodeTest(Control control) - { - - //鍔犺浇log - Loading loading = new Loading(); - this.AddChidren(loading); - HDL_ON.DAL.Server.ResponsePackNew responsePackNew = null; - loading.Start(); - new System.Threading.Thread(() => - { - try - { - responsePackNew = PirSend.CodeTest(control); - } - catch { } - finally - { - Application.RunOnMainThread(() => - { - loading.Hide(); - if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "") - { - - } - else - { - //Method method = new Method(); - //method.ErrorShow(responsePackNew); - } - - }); - } - - }) - { IsBackground = true }.Start(); } /// <summary> diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs index 9236d52..f5f2ed2 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs @@ -8,13 +8,13 @@ { public class Method { - + /// <summary> /// 绾㈠瀹濈▼搴忎富鍏ュ彛 /// </summary> /// <param name="frame"></param> /// <param name="function"></param> - public void MainView(FrameLayout frame, Entity.Function function,Action action) + public void MainView(FrameLayout frame, Entity.Function function, Action action) { Pir pirDevice = new Pir(); if (function != null) @@ -37,6 +37,7 @@ PirMain.BackAction += () => { action?.Invoke(); + PirMain.BackAction = null; }; }); }, Pir.currPir); @@ -142,7 +143,13 @@ { if (device != null) { + control.deviceId = device.deviceId; + //閬ユ帶鍣ㄦ坊鍔犲埌鍒楄〃锛� + if (null == Pir.currPir.FunctioList.Find((c) => c.deviceId == device.deviceId)) + { + Pir.currPir.FunctioList.Add(device); + } frame.RemoveFromParent();//娣诲姞鎴愬姛鍏抽棴寮圭獥 action(control); } @@ -246,7 +253,7 @@ { loading.Hide(); Method method = new Method(); - method.ErrorShow(null,"璇诲彇绾㈠瀹濆垪琛ㄥけ璐�"); + method.ErrorShow(null, "璇诲彇绾㈠瀹濆垪琛ㄥけ璐�"); } } catch { } @@ -365,9 +372,10 @@ /// <param name="view">鍒ゆ柇log鐖舵帶浠�</param> /// <param name="frame">log鐖舵帶浠�</param> /// <param name="dialog">log鐖舵帶浠�</param> - public static void ThreadSend(Control control, Action<ResponsePackNew> action, string str,string view, FrameLayout frame, Dialog dialog) + /// <param name="attributesStatus">瀛︿範鎸夐敭</param> + public static void ThreadSend(Control control, Action<ResponsePackNew> action, string str, string view, FrameLayout frame, Dialog dialog, Entity.AttributesStatus attributesStatus=null) { - + //鍔犺浇log Loading loading = new Loading(); if (view == "dialog") @@ -395,7 +403,10 @@ } else if (str == "鍒犻櫎鎸夐敭") { - // responsePackNew = PirSend.CodeRemove(control.deviceId, control.name); + if (attributesStatus != null) + { + responsePackNew = PirSend.CodeRemove(attributesStatus, control.deviceId); + } } else if (str == "鑾峰彇璁惧璇︽儏") { @@ -405,6 +416,10 @@ else if (str == "鑾峰彇閬ユ帶鍣ㄥ垪琛�") { responsePackNew = PirSend.ControlList(control.deviceId); + } + else if (str == "搴撶爜娴嬭瘯") + { + responsePackNew = PirSend.CodeTest(control); } } catch { } @@ -420,7 +435,28 @@ else { Method method = new Method(); - method.ErrorShow(responsePackNew, ""); + //鑷畾涔夐敊璇彁绀烘枃鏈� + string eorroText = ""; + if (str == "鍒犻櫎") + { + } + else if (str == "淇敼鍚嶇О") + { + + } + else if (str == "鍒犻櫎鎸夐敭") + { + } + else if (str == "鑾峰彇璁惧璇︽儏") + { + } + else if (str == "鑾峰彇閬ユ帶鍣ㄥ垪琛�") + { + } + else if (str == "搴撶爜娴嬭瘯") + { + } + method.ErrorShow(responsePackNew, eorroText); } }); @@ -504,6 +540,10 @@ { str = Language.StringByID(StringId.huoqushujushibao); } + else if (text == "娣诲姞澶辫触") + { + str = Language.StringByID(StringId.tianjiashibai); + } else { if (responsePackNew != null) @@ -550,6 +590,79 @@ case 3: { } break; } } + /// <summary> + ///鎸囧畾鍒锋柊鐣岄潰 + /// </summary> + /// <param name="strView">鍒ゆ柇瀛楃</param> + public static void RefreshView(string strView) + { + //鏍囪鏄笉鏄凡缁忓埛鏂板畬鎴� + bool if_bool = false; + for (int i = MainPage.BasePageView.ChildrenCount - 1; 0 <= i; i--) + { + var view = MainPage.BasePageView.GetChildren(i); + if (strView == "PirMain") + { + if (view.GetType() == typeof(PirMain)) + { + //寮哄埗杞崲瀵硅薄 + var f = (PirMain)view; + //绉婚櫎鎵�鏈夊瓙鎺т欢 + f.RemoveAll(); + //閲嶆柊鍔犺浇UI + f.Show(); + //閫�鍑篺or寰幆 + //break; + if_bool = true; + } + } + if (if_bool) + { + //閫�鍑篺or寰幆 + break; + } + } + } + /// <summary> + /// 鎸囧畾鍒犻櫎鐣岄潰 + /// </summary> + /// <param name="strView">鍒ゆ柇瀛楃</param> + public static void RemoveView(string strView) + { + + for (int i = MainPage.BasePageView.ChildrenCount - 1; 0 <= i; i--) + { + var view = MainPage.BasePageView.GetChildren(i); + if (strView == "PirMain") + { + if (view.GetType() == typeof(PirMain)) + { + //绉婚櫎鐣岄潰 + view.RemoveFromParent(); + } + + } + else if (strView == "AddControl") + { + + if (view.GetType() == typeof(AddControl)) + { + //鎵惧埌绉婚櫎 + view.RemoveFromParent(); + } + } + else if (strView == "AddControlComplete") + { + + if (view.GetType() == typeof(AddControlComplete)) + { + //鎵惧埌绉婚櫎 + view.RemoveFromParent(); + } + } + + } + } } [Serializable] diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Pir.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Pir.cs index 288f850..ebc2d6a 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Pir.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Pir.cs @@ -54,7 +54,7 @@ /// </summary> public List<string> library = new List<string>(); /// <summary> - /// + /// 瀛︿範鎸夐敭鍒楄〃 /// </summary> public List<AttributesStatus> status = new List<AttributesStatus>(); } diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirMain.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirMain.cs index 2967f1e..e05fc9a 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirMain.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirMain.cs @@ -91,12 +91,7 @@ SetPir setPir = new SetPir(); MainPage.BasePageView.AddChidren(setPir); - setPir.Show(() => - { - //BackAction(); - ////鍒锋柊鐣岄潰 - UIView(vv); - }); + setPir.Show(); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; }; ///娣诲姞閬ユ帶鍣ㄥ浘鏍囩偣鍑讳簨浠� @@ -362,7 +357,6 @@ public override void RemoveFromParent() { BackAction(); - BackAction = null; base.RemoveFromParent(); } diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/SetPir.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/SetPir.cs index ab952eb..74c6a9e 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/SetPir.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/SetPir.cs @@ -10,19 +10,16 @@ { public SetPir() { - Tag = "PirMain"; + Tag = "PirView"; } - Action backAction; - public void Show(Action action) + public void Show() { - backAction = action; #region 鐣岄潰甯冨眬 this.BackgroundColor = CSS.CSS_Color.viewMiddle; Intelligence.Automation.LogicView.TopView topView = new Intelligence.Automation.LogicView.TopView(); this.AddChidren(topView.FLayoutView()); topView.clickBackBtn.MouseUpEventHandler += (e, sen) => { - //action(); RemoveFromParent(); }; topView.topNameBtn.TextID = StringId.setlogic; @@ -113,16 +110,8 @@ Pir.pirDeviceList.Remove(Pir.currPir); } dialog.Close(); - action(); this.RemoveFromParent(); - for (int i = MainPage.BasePageView.ChildrenCount - 1; 0 <= i; i--) - { - var view = MainPage.BasePageView.GetChildren(i); - if (view.GetType() == typeof(PirMain)) - { - view.RemoveFromParent(); - } - } + Method.RemoveView("PirMain"); }, "鍒犻櫎", "dialog", null, dialog); }, () => @@ -141,8 +130,10 @@ /// </summary> public override void RemoveFromParent() { - backAction(); + //鍒锋柊PirMain鐣岄潰 + Method.RefreshView("PirMain"); base.RemoveFromParent(); + } } } diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/Buttons.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/Buttons.cs index 633bf36..6a79288 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/Buttons.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/Buttons.cs @@ -62,6 +62,83 @@ /// <summary> /// 鍔ㄦ�佸姞杞芥寜閽垪琛� /// </summary> + /// <param name="vv">鐖舵帶浠�</param> + /// <param name="list">鏁版嵁鍒楄〃</param> + /// <param name="action">鍥炶皟</param> + /// <param name="if_bool">琛ㄧず鏄惁鏄剧ず鍒犻櫎鍥炬爣</param> + public void AddButton2(VerticalScrolViewLayout vv, List<Entity.AttributesStatus> list, Action<Entity.AttributesStatus> action, bool if_bool) + { + //瀹氫箟涓�涓彉閲忚褰曡鏁� + int sum = 0; + if (list.Count % 3 == 0) + { + sum = list.Count / 3; + } + else + { + sum = list.Count / 3 + 1; + } + //璁$畻鍔犺浇鍑烘潵鐨勬暟鎹渶瑕佺殑楂樺害 + int h = 16 + sum * (16 + 44) + 104 + 76; + int line = 0; + //鎸夐挳鐨勭埗鎺т欢 + var FLayout = new FrameLayout + { + Height = Application.GetRealWidth(h), + }; + vv.AddChidren(FLayout); + for (int i = 1, j = 0; i <= list.Count; i++, j++) + { + var nameObj = list[i - 1]; + //鎸夐挳 + var buttonNameBtn = new Button + { + + Y = Application.GetRealHeight(16 + 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); + //鍒犻櫎鍥炬爣 + var delIconBtn = new Button + { + UnSelectedImagePath = "PirIcon/delbuton.png", + Y = Application.GetRealHeight(12 + line * (16 + 44)), + X = Application.GetRealWidth((16 + 92) + (104 + 16) * j), + Width = Application.GetRealWidth(16), + Height = Application.GetRealWidth(16), + Tag = nameObj, + }; + if (if_bool) + { + FLayout.AddChidren(delIconBtn); + } + //鍒犻櫎鍥炬爣鐨勭偣鍑讳簨浠� + delIconBtn.MouseUpEventHandler += (sender, e) => + { + var obj = delIconBtn.Tag as Entity.AttributesStatus; + action(obj); + }; + if (i % 3 == 0) + { + //婊′竴琛岄噸缃甹=0鍊�; + j = -1; + line += 1; + } + + } + } + /// <summary> + /// 鍔ㄦ�佸姞杞芥寜閽垪琛� + /// </summary> /// <param name="FLayout">鐖舵帶浠�</param> /// <param name="action">鍥炶皟</param> /// <param name="sum">澶氬皯涓狥rameLayout鎺т欢</param> -- Gitblit v1.8.0