From 6ae83acae578c6746201fbd61074a7b93747ef4f Mon Sep 17 00:00:00 2001 From: 陈嘉乐 <cjl@hdlchina.com.cn> Date: 星期一, 08 三月 2021 17:47:52 +0800 Subject: [PATCH] 2021-3-8-4 --- HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs | 64 +++++++++++-------------------- 1 files changed, 23 insertions(+), 41 deletions(-) diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs index 8d5d538..3b9cb15 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs @@ -18,18 +18,12 @@ { ///娓呴櫎涔嬪墠鍒楄〃鏁版嵁 Pir.BuottonList.Clear(); - if (!string.IsNullOrEmpty(name)) - { - Control control = new Control(); - control.name = name; - control.type = "learn"; - control.spk = "ir.learn"; - control.deviceId = Pir.currPir.deviceId; - ThreadAddControl(control, frame, action); - - - - } + Control control = new Control(); + control.name = name; + control.type = "learn"; + control.spk = "ir.learn"; + control.deviceId = Pir.currPir.deviceId; + ThreadAddControl(control, frame, action); }, false); } @@ -40,7 +34,6 @@ /// <param name="frame"></param> public void ThreadAddControl(Control control, FrameLayout frame, Action<Control> action) { - DAL.Server.ResponsePackNew responsePackNew = null; Loading loading = new Loading(); frame.AddChidren(loading); @@ -59,21 +52,14 @@ loading.Hide(); if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "") { - bool bool_if = false; string sid = responsePackNew.Data.ToString(); - var mqttdate = MqttDate(); - for (int i = 0; i < mqttdate.objects.Count; i++) { - var objects = mqttdate.objects[i]; - if (sid == objects.sid) { - bool_if = true; - break; - } - } - if (bool_if) + var mqttdate = MqttDate(sid); + if (mqttdate.id!="") { ///杩欓噷锛氱洃鍚琈TTP鎺ㄩ�佷笅鏉ヤ富棰橈紝鎵嶇煡閬撴槸鍚︽坊鍔犳垚鍔� frame.RemoveFromParent();//娣诲姞鎴愬姛鍏抽棴寮圭獥 control.deviceId = mqttdate.id; + control.sid = sid; action(control); } else @@ -250,36 +236,32 @@ /// </summary> public static string addcontronsid = ""; /// <summary> - /// + /// 鍒ゆ柇杩欎釜涓婚鏄惁鏄坊鍔犻仴鎺у櫒涓婚 /// </summary> /// <returns></returns> - public Cloud MqttDate() + public Cloud MqttDate(string sid) { + Cloud cloud = new Cloud(); var dateTime = DateTime.Now; - while ((DateTime.Now - dateTime).TotalMilliseconds < 5 * 1000) + while ((DateTime.Now - dateTime).TotalMilliseconds < 10 * 1000) { if (!string.IsNullOrEmpty(addcontronsid)) { + cloud = Newtonsoft.Json.JsonConvert.DeserializeObject<Cloud>(addcontronsid); + for (int i = 0; i < cloud.objects.Count; i++) + { + var objects = cloud.objects[i]; + if (sid == objects.sid) + { + break; + } + } break; } } - return PushData(); - } - - public Cloud PushData() - { - Cloud cloud = new Cloud(); - if (addcontronsid != "") - { - //var date = Newtonsoft.Json.JsonConvert.SerializeObject(addcontronsid); - cloud = Newtonsoft.Json.JsonConvert.DeserializeObject<Cloud>(addcontronsid); - - } return cloud; } - - /// <summary> /// 閿欒鐮佹彁绀� @@ -307,7 +289,7 @@ /// <summary> /// 璁惧id /// </summary> - public string id = string.Empty; + public string id =""; public List<Objects> objects = new List<Objects>(); public string time_stamp = string.Empty; -- Gitblit v1.8.0