From 6b5f23413ceac72ad97d354e658798c8a422f556 Mon Sep 17 00:00:00 2001 From: 陈嘉乐 <cjl@hdlchina.com.cn> Date: 星期二, 16 三月 2021 16:52:17 +0800 Subject: [PATCH] 2021-3-26-3 --- HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs | 121 +++++++++++++++++++++++++++++++++++++++- 1 files changed, 117 insertions(+), 4 deletions(-) diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs index f0565fd..e62c484 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs @@ -181,10 +181,24 @@ var pirJosn = Newtonsoft.Json.JsonConvert.DeserializeObject<Pir>(str); if (pirJosn != null) { - if (null == Pir.pirDeviceList.Find((c) => c.deviceId == pirJosn.deviceId)) + +/* 椤圭洰鈥淗DL-ON_iOS鈥濈殑鏈悎骞剁殑鏇存敼 +鍦ㄦ涔嬪墠: + if (null == Pir.pirDeviceList.Find((c) => c.deviceId == pirJosn.deviceId)) +鍦ㄦ涔嬪悗: + if (null == list.pirDeviceList.Find((c) => c.deviceId == pirJosn.deviceId)) +*/ + if (null == PirDevice.Pir.pirDeviceList.Find((c) => c.deviceId == pirJosn.deviceId)) { - Pir.pirDeviceList.Add(pirJosn); + +/* 椤圭洰鈥淗DL-ON_iOS鈥濈殑鏈悎骞剁殑鏇存敼 +鍦ㄦ涔嬪墠: + Pir.pirDeviceList.Add(pirJosn); +鍦ㄦ涔嬪悗: + list.pirDeviceList.Add(pirJosn); +*/ + PirDevice.Pir.pirDeviceList.Add(pirJosn); } } @@ -320,6 +334,7 @@ }) { IsBackground = true }.Start(); } + /// <summary> /// 鍙戦�佸懡浠ょ嚎绋� /// </summary> @@ -327,15 +342,113 @@ /// <param name="action">鍥炶皟鍑芥暟</param> /// <param name="str">鍒ゆ柇瀛楃</param> /// <param name="frame">log鐖舵帶浠�</param> - /// <param name="dialog">log鐖舵帶浠�</param> - public void ThreadSend(Control control, Action<HDL_ON.DAL.Server.ResponsePackNew> action, string str, FrameLayout frame, Dialog dialog) + public void ThreadSend(Control control, Action<ResponsePackNew> action, string str, FrameLayout frame) { + + //鍔犺浇log + Loading loading = new Loading(); + frame.AddChidren(loading); + loading.Start(); + ResponsePackNew responsePackNew = null; + new System.Threading.Thread(() => + { + try + { + if (str == "鍒犻櫎") + { + responsePackNew = PirSend.DeleteDevice(control.deviceId); + } + else if (str == "淇敼鍚嶇О") + { + responsePackNew = PirSend.DeviceRename(control.deviceId, control.name); + } + else if (str == "鍒犻櫎鎸夐敭") { + // responsePackNew = PirSend.CodeRemove(control.deviceId, control.name); + } + } + catch { } + finally + { + Application.RunOnMainThread(() => + { + loading.Hide(); + if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "") + { + action(responsePackNew); + } + else + { + Method method = new Method(); + method.ErrorShow(responsePackNew, ""); + } + + }); + } + + }) + { IsBackground = true }.Start(); } + /// <summary> + /// 鍙戦�佸懡浠ょ嚎绋� + /// </summary> + /// <param name="control">鍙戦�佹暟鎹璞�</param> + /// <param name="action">鍥炶皟鍑芥暟</param> + /// <param name="str">鍒ゆ柇瀛楃</param> + /// <param name="dialog">log鐖舵帶浠�</param> + public void ThreadSend(Control control, Action<ResponsePackNew> action, string str,Dialog dialog) + { + //鍔犺浇log + Loading loading = new Loading(); + dialog.AddChidren(loading); + ResponsePackNew responsePackNew = null; + loading.Start(); + new System.Threading.Thread(() => + { + try + { + if (str == "鍒犻櫎") + { + responsePackNew = PirSend.DeleteDevice(control.deviceId); + } + else if (str == "淇敼鍚嶇О") + { + + responsePackNew = PirSend.DeviceRename(control.deviceId, control.name); + } + else if (str == "鍒犻櫎鎸夐敭") + { + // responsePackNew = PirSend.CodeRemove(control.deviceId, control.name); + } + } + catch { } + finally + { + Application.RunOnMainThread(() => + { + loading.Hide(); + if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "") + { + action(responsePackNew); + } + else + { + Method method = new Method(); + method.ErrorShow(responsePackNew, ""); + } + + }); + } + + }) + { IsBackground = true }.Start(); + + + } /// <summary> /// MQTT涓婚鎺ㄩ�佷笅鏉ョ殑閬ユ帶鍣ㄦ暟鎹� /// </summary> -- Gitblit v1.8.0