From eb76239882830f3960b8800bb0f2c90ca7b3f378 Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期四, 04 八月 2022 09:19:10 +0800
Subject: [PATCH] Merge branch 'release0123'

---
 HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/Iot_AuthorizedPage.cs |  107 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 107 insertions(+), 0 deletions(-)

diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/Iot_AuthorizedPage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/Iot_AuthorizedPage.cs
new file mode 100644
index 0000000..e3c0244
--- /dev/null
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/Iot_AuthorizedPage.cs
@@ -0,0 +1,107 @@
+锘縰sing System;
+using Shared;
+using HDL_ON.Entity;
+using HDL_ON.DAL.Server;
+
+namespace HDL_ON.UI
+{
+    public class Iot_AuthorizedPage
+    {
+        HttpServerRequest http = new HttpServerRequest();
+
+        IntegratedBrand_Iot brand_Iot;
+
+        Action boudedAction;
+
+        public Iot_AuthorizedPage(IntegratedBrand_Iot brand,Action action)
+        {
+            brand_Iot = brand;
+            boudedAction = action;
+        }
+
+        
+
+        public void LoadView()
+        {
+            string url = brand_Iot.authorizationUrl + $"?companyId={brand_Iot.companyId}&openUId={UserInfo.Current.ID}&client_id={brand_Iot.clientId}";
+            var dd = new WebViewDialog(()=> {
+                UnsubscribeAsync3tyIotbind();
+            });
+            dd.LoadPage("", url);
+            DAL.Mqtt.MqttClient.Bind3tyIotAction = () => {
+                UnsubscribeAsync3tyIotbind();
+                Application.RunOnMainThread(() =>
+                {
+                    http.Search3tyIotDevice(brand_Iot.companyId);
+                    boudedAction?.Invoke();
+                    dd.Close();
+                });
+            };
+            SubscribeAsync3tyIotbind();
+        }
+
+        /// <summary>
+        /// 璁㈤槄缁戝畾绗笁鏂筰ot璐﹀彿缁撴灉
+        /// </summary>
+        private void SubscribeAsync3tyIotbind()
+        {
+            new System.Threading.Thread(async () =>
+            {
+                try
+                {
+                    var result = await DAL.Mqtt.MqttClient.SubscribeAsync3tyIotbind();
+                }
+                catch { }
+                finally
+                {
+
+                }
+            })
+            { IsBackground = true }.Start();
+        }
+
+        /// <summary>
+        /// 鍙栨秷璁㈤槄缁戝畾绗笁鏂筰ot璐﹀彿缁撴灉
+        /// </summary>
+        private void UnsubscribeAsync3tyIotbind()
+        {
+            new System.Threading.Thread(async () =>
+            {
+                try
+                {
+                    var result = await DAL.Mqtt.MqttClient.UnsubscribeAsync3tyIotbind();
+                }
+                catch { }
+                finally
+                {
+
+                }
+            })
+            { IsBackground = true }.Start();
+        }
+        /// <summary>
+        /// 鎼滅储绗笁鏂硅澶�
+        /// </summary>
+        private void SearchDevice()
+        {
+            var pack = http.Search3tyIotDevice(brand_Iot.companyId);
+            if(pack!= null)
+            {
+
+            }
+        }
+
+        /// <summary>
+        /// 鑾峰彇绗笁鏂瑰姛鑳藉垪琛�
+        /// </summary>
+        private void GetFunction()
+        {
+            var pack = http.Get3tyIotDeviceFunctionList(brand_Iot.companyId);
+            if(pack != null)
+            {
+
+            }
+        }
+
+    }
+}

--
Gitblit v1.8.0