From 598329348fef499fb9fccbef75a0bb3d53bd50b0 Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期三, 03 八月 2022 17:40:05 +0800 Subject: [PATCH] 紧急求助按钮修复 --- HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/Iot_AuthorizedPage.cs | 65 ++++++++++++++++++++++++++++++++ 1 files changed, 64 insertions(+), 1 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 index 366aa1d..e3c0244 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/Iot_AuthorizedPage.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/Iot_AuthorizedPage.cs @@ -11,11 +11,74 @@ IntegratedBrand_Iot brand_Iot; - public Iot_AuthorizedPage(IntegratedBrand_Iot brand) + 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> -- Gitblit v1.8.0