From 7584dea0241cefc276a4b5311331aee1dcda6c80 Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期二, 16 三月 2021 11:44:41 +0800 Subject: [PATCH] Merge branch 'WJC' into temp-wxr --- HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/EditControl.cs | 110 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 110 insertions(+), 0 deletions(-) diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/EditControl.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/EditControl.cs new file mode 100644 index 0000000..0325f8a --- /dev/null +++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/EditControl.cs @@ -0,0 +1,110 @@ +锘縰sing System; +using Shared; +using System.Collections.Generic; +using HDL_ON.UI.UI2.PersonalCenter.PirDevice.View; + +namespace HDL_ON.UI.UI2.PersonalCenter.PirDevice +{ + public class EditControl : FrameLayout + { + public EditControl() + { + } + + public void Show(Entity.Function control, Pir pir, Action<Entity.Function> action) + { + + this.BackgroundColor = CSS.CSS_Color.viewMiddle; + PirDevice.View.TopView topView = new View.TopView(); + topView.topNameBtn.TextID = StringId.pipeiyaokongqi; + this.AddChidren(topView.FLayoutView()); + topView.clickBackBtn.MouseUpEventHandler += (e, sen) => + { + action(control); + RemoveFromParent(); + }; + topView.topNameBtn.TextID = StringId.bianjixinxi; + FrameLayout viewLayout = new FrameLayout + { + Y = Application.GetRealHeight(64), + Width = Application.GetRealWidth(375), + Height = Application.GetRealHeight(667 - 64), + BackgroundColor = CSS.CSS_Color.viewMiddle, + }; + this.AddChidren(viewLayout); + + FrameLayout50 editNameFLayout = new FrameLayout50(); + editNameFLayout.btnText.Text = Language.StringByID(StringId.yaokongqimingcheng) + ":"; + editNameFLayout.btnEditText.Text = control.name; + editNameFLayout.btnNextIcon.Height = Application.GetRealWidth(28); + editNameFLayout.btnNextIcon.Width = Application.GetRealWidth(28); + editNameFLayout.btnNextIcon.UnSelectedImagePath = "LogicIcon/editname.png"; + viewLayout.AddChidren(editNameFLayout.FLayoutView()); + + FrameLayout50 areaFLayout = new FrameLayout50(); + areaFLayout.btnText.Text = Language.StringByID(StringId.yaokongqiquyu); + areaFLayout.btnEditText.Text = Intelligence.Automation.LogicMethod.GetGetRoomName(control); + areaFLayout.frameLayout.Y = editNameFLayout.frameLayout.Bottom; + viewLayout.AddChidren(areaFLayout.FLayoutView()); + + editNameFLayout.btnClick.MouseUpEventHandler += (sender, e) => + { + List<string> list = new List<string>(); + + for (int i = 0; i < pir.FunctioList.Count; i++) + { + list.Add(pir.FunctioList[i].name); + } + Method method = new Method(); + method.EditControlName(StringId.editName,list, control.name, (name,view) => + { + //鍔犺浇log + Loading loading = new Loading(); + view.AddChidren(loading); + HDL_ON.DAL.Server.ResponsePackNew responsePackNew = null; + loading.Start(); + new System.Threading.Thread(() => + { + try + { + responsePackNew = PirSend.DeviceRename(control.deviceId, control.name); + } + catch { } + finally + { + Application.RunOnMainThread(() => + { + loading.Hide(); + if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "") + { + view.Close(); + editNameFLayout.btnEditText.Text = name; + control.name = name; + } + else + { + Method methodError = new Method(); + methodError.ErrorShow(responsePackNew); + } + + }); + } + + }) + { IsBackground = true }.Start(); + + + },()=> { }); + }; + areaFLayout.btnClick.MouseUpEventHandler += (sender, e) => + { + Method method = new Method(); + method.ManagementPosition(control, () => + { + //鏇存柊鍖哄煙 + areaFLayout.btnEditText.Text = Intelligence.Automation.LogicMethod.GetGetRoomName(control); + }); + }; + } + } +} -- Gitblit v1.8.0