From 16277f0b999eb1b2c6bbcf710be04cadaf2a07fa Mon Sep 17 00:00:00 2001 From: 陈嘉乐 <cjl@hdlchina.com.cn> Date: 星期五, 12 三月 2021 15:20:21 +0800 Subject: [PATCH] 2021-03-12-2 --- HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/DeviceSet.cs | 113 ++++++++++++++++++++++++++++++-------------------------- 1 files changed, 60 insertions(+), 53 deletions(-) diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/DeviceSet.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/DeviceSet.cs index 7f35847..33aee38 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/DeviceSet.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/DeviceSet.cs @@ -19,7 +19,8 @@ topView.topNameBtn.TextID = StringId.shebeigaunli; topView.topIconBtn.Visible = true; this.AddChidren(topView.FLayoutView()); - topView.clickBackBtn.MouseUpEventHandler += (sender, e) => { + topView.clickBackBtn.MouseUpEventHandler += (sender, e) => + { action(); this.RemoveFromParent(); }; @@ -32,14 +33,14 @@ //鍏抽棴鍒锋柊View锛� vv.EndHeaderRefreshing(); //鑾峰彇鍒楄〃 - Method.GetPirDeviceList(this,() => - { - Application.RunOnMainThread(() => - { + Method.GetPirDeviceList(this, () => + { + Application.RunOnMainThread(() => + { //鍒锋柊鐣岄潰 UIView(vv); - }); - }); + }); + }); }; #endregion @@ -164,14 +165,17 @@ TextAlignment = TextAlignment.CenterLeft, TextSize = TextSize.text12, TextColor = 0xFF67D569,// CSS.CSS_Color.textColor, - SelectedTextColor =CSS.CSS_Color.textRedColor, + SelectedTextColor = CSS.CSS_Color.textRedColor, IsBold = true, }; devfLayout.AddChidren(stateTextBtn); - if (pirDevice.online) { + if (pirDevice.online) + { stateIconBtn.IsSelected = true; stateTextBtn.IsSelected = true; - } else { + } + else + { stateIconBtn.IsSelected = false; stateTextBtn.IsSelected = false; } @@ -291,54 +295,58 @@ } delBtn.MouseUpEventHandler += (sender, e) => { - var Function = delBtn.Tag as Entity.Function; - //鍔犺浇log - Loading loading = new Loading(); - this.AddChidren(loading); - HDL_ON.DAL.Server.ResponsePackNew responsePackNew = null; - loading.Start(); - new System.Threading.Thread(() => + string text = Language.StringByID(StringId.shanchushebei) + Function.name + "?"; + TipPopView tipPopView = new TipPopView(); + tipPopView.TipBox(StringId.tip, text, (dialog) => { - try + //鍔犺浇log + Loading loading = new Loading(); + dialog.AddChidren(loading); + HDL_ON.DAL.Server.ResponsePackNew responsePackNew = null; + loading.Start(); + new System.Threading.Thread(() => { - responsePackNew = PirSend.DeleteDevice(Function.deviceId); - } - catch { } - finally - { - Application.RunOnMainThread(() => + try { - loading.Hide(); - try + responsePackNew = PirSend.DeleteDevice(Function.deviceId); + } + catch { } + finally + { + Application.RunOnMainThread(() => { - if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "") + loading.Hide(); + try { - var function = pirDevice.FunctioList.Find((c)=>c.sid== Function.sid); - if (function != null) + if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "") { - pirDevice.FunctioList.Remove(Function); - if (Pir.currPir != null && pirDevice.sid == Pir.currPir.sid) + dialog.Close(); + var function = pirDevice.FunctioList.Find((c) => c.sid == Function.sid); + if (function != null) { - Pir.currPir.FunctioList = pirDevice.FunctioList; + pirDevice.FunctioList.Remove(Function); + if (Pir.currPir != null && pirDevice.sid == Pir.currPir.sid) + { + Pir.currPir.FunctioList = pirDevice.FunctioList; + } } + UIView(vv); } - UIView(vv); + else + { + Method method = new Method(); + method.ErrorShow(responsePackNew); + } } + catch { } - else - { - Method method = new Method(); - method.ErrorShow(responsePackNew); - } - } - catch { } + }); + } - }); - } - - }) - { IsBackground = true }.Start(); + }) + { IsBackground = true }.Start(); + }, () => { }, false); }; EventHandler<MouseEventArgs> editClick = (sender, e) => { @@ -358,8 +366,6 @@ areaBtn.MouseUpEventHandler += editClick; nextIconBtn.MouseUpEventHandler += editClick; } - - } } @@ -383,14 +389,14 @@ { list.Add(Pir.pirDeviceList[b].name); } - Method methodView = new Method(); + Method methodView = new Method(); methodView.EditControlName(StringId.xiugaimingzi, list, pirclick.name, (name, view) => { pirclick.name = name; + HDL_ON.DAL.Server.ResponsePackNew responsePackNew = null; //鍔犺浇log Loading loading = new Loading(); view.AddChidren(loading); - HDL_ON.DAL.Server.ResponsePackNew responsePackNew = null; loading.Start(); new System.Threading.Thread(() => { @@ -420,9 +426,10 @@ }) { IsBackground = true }.Start(); - },()=> { + }, () => + { NewSwitchView(pirclick, vv); - },false); + }, false); } else @@ -431,10 +438,10 @@ TipPopView tipPopView = new TipPopView(); tipPopView.TipBox(StringId.tip, text, (dialog) => { + HDL_ON.DAL.Server.ResponsePackNew responsePackNew = null; //鍔犺浇log Loading loading = new Loading(); dialog.AddChidren(loading); - HDL_ON.DAL.Server.ResponsePackNew responsePackNew = null; loading.Start(); new System.Threading.Thread(() => { @@ -474,6 +481,6 @@ }); } - + } } -- Gitblit v1.8.0