From a469a96ee8c38f7d98366dcd633e3a15f92fec65 Mon Sep 17 00:00:00 2001
From: 陈嘉乐 <cjl@hdlchina.com.cn>
Date: 星期一, 01 三月 2021 17:53:52 +0800
Subject: [PATCH] 2021-3-1-1

---
 HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs |  107 ++++++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 93 insertions(+), 14 deletions(-)

diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs
index 0c7d14f..ce82452 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs
@@ -1,6 +1,8 @@
 锘縰sing System;
 using HDL_ON.DAL.Server;
 using Shared;
+using System.Collections.Generic;
+using Newtonsoft.Json.Linq;
 
 namespace HDL_ON.UI.UI2.PersonalCenter.PirDevice
 {
@@ -22,12 +24,12 @@
                     control.name = s;
                     control.type = "learn";
 
-                    ThreadAddControl(control,dialog);
+                    ThreadAddControl(control, dialog);
 
 
 
                 }
-            },false);
+            }, false);
 
         }
         /// <summary>
@@ -55,19 +57,20 @@
                         loading.Hide();
                         //if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "")
                         //{
-                            ///杩欓噷锛氱洃鍚琈TTP鎺ㄩ�佷笅鏉ヤ富棰橈紝鎵嶇煡閬撴槸鍚︽坊鍔犳垚鍔�
-                            dialog.Close();//娣诲姞鎴愬姛鍏抽棴寮圭獥
-                            AddButton addButton = new AddButton();
-                            MainPage.BasePageView.AddChidren(addButton);
-                            addButton.Show(control);
-                            MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+                        if (!string.IsNullOrEmpty(Sid("sid"))) { }
+                        ///杩欓噷锛氱洃鍚琈TTP鎺ㄩ�佷笅鏉ヤ富棰橈紝鎵嶇煡閬撴槸鍚︽坊鍔犳垚鍔�
+                        dialog.Close();//娣诲姞鎴愬姛鍏抽棴寮圭獥
+                        AddButton addButton = new AddButton();
+                        MainPage.BasePageView.AddChidren(addButton);
+                        addButton.Show(control);
+                        MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
 
-                            //鐩戝惉Mqtt鎺ㄩ�佷笅鏉ョ姸鎬佺爜鍋氭彁绀�
-                            //View.FailView failView = new View.FailView();
-                            //failView.ShouError((view) => {
-                            //    view.Close();
-                            //    ThreadAddControl(control, dialog);
-                            //});
+                        //鐩戝惉Mqtt鎺ㄩ�佷笅鏉ョ姸鎬佺爜鍋氭彁绀�
+                        //View.FailView failView = new View.FailView();
+                        //failView.ShouError((view) => {
+                        //    view.Close();
+                        //    ThreadAddControl(control, dialog);
+                        //});
                         //}
                         //else
                         //{
@@ -78,6 +81,54 @@
             })
             { IsBackground = true }.Start();
 
+        }
+
+        public  List<DD> GetLsit(FrameLayout frameLayout, Action<ResponsePackNew> action, string id, string if_str)
+        {
+            List<DD> list = new List<DD>();
+            ResponsePackNew responsePackNew = null;
+           PirSend.GetDeviceTypesList(frameLayout, action, id, if_str);
+
+            if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "")
+            {
+                var jArray = JArray.Parse(responsePackNew.Data.ToString());
+                for (int a = 0; a < jArray.Count; a++)
+                {
+                    var jay = jArray[a];
+                    var str = Newtonsoft.Json.JsonConvert.SerializeObject(jay);
+                    list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<DD>>(str);
+                   
+
+                }
+            }
+            else
+            {
+                Method method = new Method();
+                method.ErrorShow(responsePackNew);
+            }
+            return list;
+        }
+        /// <summary>
+        /// MQTT涓婚鎺ㄩ�佷笅鏉ョ殑鏁版嵁(閬ユ帶鍣ㄦ坊鍔�)
+        /// </summary>
+        public static string addcontronsid = "";
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="sid"></param>
+        /// <returns></returns>
+        public string Sid(string sid)
+        {
+            var dateTime = DateTime.Now;
+            while ((DateTime.Now - dateTime).TotalMilliseconds < 5* 1000)
+            {
+                if (!string.IsNullOrEmpty(addcontronsid) && addcontronsid == sid)
+                {
+                    break;
+                }
+
+            }
+            return addcontronsid;
         }
         /// <summary>
         /// 閿欒鐮佹彁绀�
@@ -97,5 +148,33 @@
 
             }
         }
+        [Serializable]
+        public class DD
+        {
+            /// <summary>
+            /// 璁惧绫诲瀷涓婚敭Id
+            /// </summary>
+            public string id=string.Empty;
+            /// <summary>
+            /// 璁惧绫诲瀷(鎶曞奖浠�,椋庢墖,鏈洪《鐩�...)
+            /// </summary>
+            public string deviceType = string.Empty;
+            /// <summary>
+            ///鍝佺墝鍚嶇О
+            /// </summary>
+            public string brandName = string.Empty;
+            /// <summary>
+            /// 绾㈠鐮�
+            /// </summary>
+            public string irCode = string.Empty;
+            /// <summary>
+            /// 鍝佺墝涓婚敭Id
+            /// </summary>
+            public string brandId = string.Empty;
+            /// <summary>
+            /// 绾㈠鐮佺储寮曞簭鍙�
+            /// </summary>
+            public string irIndex = string.Empty;
+        }
     }
 }

--
Gitblit v1.8.0