From 1d1cad99a27c9f644c84eb3d376c70bd30a55879 Mon Sep 17 00:00:00 2001 From: 陈嘉乐 <cjl@hdlchina.com.cn> Date: 星期三, 10 三月 2021 18:02:13 +0800 Subject: [PATCH] 2021-3-10-1 --- HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/DeviceSet.cs | 59 +++++++++++++++++++++++++++++++++++++++++++++++------------ 1 files changed, 47 insertions(+), 12 deletions(-) diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/DeviceSet.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/DeviceSet.cs index d7b7c56..7f35847 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/DeviceSet.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/DeviceSet.cs @@ -11,7 +11,7 @@ { Tag = "PirView"; } - public void Show() + public void Show(Action action) { #region 鐣岄潰甯冨眬 this.BackgroundColor = CSS.CSS_Color.viewMiddle; @@ -19,7 +19,10 @@ topView.topNameBtn.TextID = StringId.shebeigaunli; topView.topIconBtn.Visible = true; this.AddChidren(topView.FLayoutView()); - topView.clickBackBtn.MouseUpEventHandler += (sender, e) => { this.RemoveFromParent(); }; + topView.clickBackBtn.MouseUpEventHandler += (sender, e) => { + action(); + this.RemoveFromParent(); + }; VerticalRefreshLayout vv = new VerticalRefreshLayout(); vv.Height = Application.GetRealHeight(667 - 64); vv.Y = Application.GetRealHeight(64); @@ -147,6 +150,7 @@ Width = Application.GetRealWidth(8), Height = Application.GetRealWidth(8), UnSelectedImagePath = "PirIcon/online.png", + SelectedImagePath = "PirIcon/offline.png", }; devfLayout.AddChidren(stateIconBtn); //绾㈠瀹濈姸鎬侊紙鍦ㄧ嚎-绂荤嚎锛� @@ -160,9 +164,17 @@ TextAlignment = TextAlignment.CenterLeft, TextSize = TextSize.text12, TextColor = 0xFF67D569,// CSS.CSS_Color.textColor, + SelectedTextColor =CSS.CSS_Color.textRedColor, IsBold = true, }; devfLayout.AddChidren(stateTextBtn); + if (pirDevice.online) { + stateIconBtn.IsSelected = true; + stateTextBtn.IsSelected = true; + } else { + stateIconBtn.IsSelected = false; + stateTextBtn.IsSelected = false; + } //绾� Button lineBtn = new Button { @@ -201,7 +213,7 @@ for (int j = 0; j < pirDevice.FunctioList.Count; j++) { - var control = pirDevice.FunctioList[i]; + var control = pirDevice.FunctioList[j]; RowLayout funControlRow = new RowLayout { Y = Application.GetRealHeight(92 + (50 * j)), @@ -230,7 +242,7 @@ X = Application.GetRealWidth(311 + 16 - (40 + 100)), Width = Application.GetRealWidth(100), Height = Application.GetRealHeight(17), - Text = j.ToString(), + Text = Intelligence.Automation.LogicMethod.GetGetRoomName(control), TextAlignment = TextAlignment.CenterRight, TextSize = TextSize.text12, TextColor = CSS.CSS_Color.textCancelColor, @@ -302,7 +314,15 @@ { if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "") { - pirDevice.FunctioList.Remove(Function); + var function = pirDevice.FunctioList.Find((c)=>c.sid== Function.sid); + if (function != null) + { + pirDevice.FunctioList.Remove(Function); + if (Pir.currPir != null && pirDevice.sid == Pir.currPir.sid) + { + Pir.currPir.FunctioList = pirDevice.FunctioList; + } + } UIView(vv); } @@ -320,6 +340,23 @@ }) { IsBackground = true }.Start(); }; + EventHandler<MouseEventArgs> editClick = (sender, e) => + { + EditControl editControl = new EditControl(); + MainPage.BasePageView.AddChidren(editControl); + editControl.Show(control, pirDevice, (device) => + { + //鍥炶皟鏇存柊鍚嶅瓧/鍖哄煙 + nameBtn.Text = device.name; + areaBtn.Text = Intelligence.Automation.LogicMethod.GetGetRoomName(device); + + }); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + }; + funControlRow.MouseUpEventHandler += editClick; + nameBtn.MouseUpEventHandler += editClick; + areaBtn.MouseUpEventHandler += editClick; + nextIconBtn.MouseUpEventHandler += editClick; } @@ -346,8 +383,8 @@ { list.Add(Pir.pirDeviceList[b].name); } - TipPopView tipPopView = new TipPopView(); - tipPopView.InputBox(StringId.xiugaimingzi, pirclick.name, StringId.nameNull, StringId.NameAlreadyExists, list, (name, view) => + Method methodView = new Method(); + methodView.EditControlName(StringId.xiugaimingzi, list, pirclick.name, (name, view) => { pirclick.name = name; //鍔犺浇log @@ -359,7 +396,7 @@ { try { - responsePackNew = PirSend.DeviceRename(pirclick); + responsePackNew = PirSend.DeviceRename(pirclick.deviceId, pirclick.name); } catch { } finally @@ -383,11 +420,9 @@ }) { IsBackground = true }.Start(); - - }, () => - { + },()=> { NewSwitchView(pirclick, vv); - }, false); + },false); } else -- Gitblit v1.8.0