From a9d1161b1df96e7ddad566335989a1444e433ef5 Mon Sep 17 00:00:00 2001 From: wjc <1243177876@qq.com> Date: 星期二, 28 三月 2023 11:54:45 +0800 Subject: [PATCH] 2023年03月28日11:52:02 --- HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/Iot_AuthorizedPage.cs | 165 +++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 159 insertions(+), 6 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..809444b 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/Iot_AuthorizedPage.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/Iot_AuthorizedPage.cs @@ -2,6 +2,7 @@ using Shared; using HDL_ON.Entity; using HDL_ON.DAL.Server; +using HDL_ON.UI.CSS; namespace HDL_ON.UI { @@ -11,24 +12,176 @@ 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(); + + + + { + Dialog dialog = new Dialog() + { + BackgroundColor = CSS_Color.DialogTransparentColor1, + }; + + FrameLayout contentView = new FrameLayout() + { + Gravity = Gravity.Center, + Width = Application.GetRealWidth(305), + Height = Application.GetRealHeight(180), + BackgroundColor = CSS.CSS_Color.MainBackgroundColor, + BorderColor = 0x00000000, + BorderWidth = 0, + Radius = (uint)Application.GetMinRealAverage(10), + }; + dialog.AddChidren(contentView); + + Button btnTitle = new Button() + { + Gravity = Gravity.CenterHorizontal, + Y = Application.GetRealHeight(10), + Height = Application.GetRealHeight(38), + TextAlignment = TextAlignment.Center, + IsBold = true, + TextColor = 0xFF222222, + TextSize = CSS_FontSize.SubheadingFontSize, + TextID = StringId.Tip + }; + contentView.AddChidren(btnTitle); + + Button btnMsg = new Button() + { + Gravity = Gravity.CenterHorizontal, + Height = Application.GetRealHeight(70), + Y = Application.GetRealHeight(55), + TextAlignment = TextAlignment.TopCenter, + TextColor = CSS_Color.FirstLevelTitleColor, + TextSize = CSS_FontSize.SubheadingFontSize, + Padding = new Padding(0, Application.GetRealWidth(16), 0, Application.GetRealWidth(16)), + Text = "璐︽埛缁戝畾鎴愬姛锛屾偍鍙互缁х画瀹屾垚璁惧鍏宠仈鎿嶄綔", + IsMoreLines = true, + }; + contentView.AddChidren(btnMsg); + if(Language.CurrentLanguage != "Chinese") + { + btnMsg.Text = "Account binding is successful.You can continue to complete the device association operation"; + } + + Button btnLine = new Button() + { + Y = Application.GetRealHeight(125), + Height = Application.GetRealHeight(1), + BackgroundColor = CSS.CSS_Color.DividingLineColor, + }; + contentView.AddChidren(btnLine); + + Button btnConfirm = new Button() + { + Y = btnLine.Bottom, + Height = Application.GetRealHeight(55), + TextAlignment = TextAlignment.Center, + TextColor = CSS_Color.MainColor, + TextSize = CSS_FontSize.SubheadingFontSize, + SelectedTextColor = CSS_Color.MainBackgroundColor, + SelectedBackgroundColor = CSS_Color.MainColor, + TextID = StringId.Confirm, + }; + btnConfirm.SetCornerWithSameRadius(Application.GetMinRealAverage(10), HDLUtils.RectCornerBottomLeft); + btnConfirm.SetCornerWithSameRadius(Application.GetMinRealAverage(10), HDLUtils.RectCornerBottomRight); + contentView.AddChidren(btnConfirm); + + dialog.Show(); + + btnConfirm.MouseDownEventHandler += (sender, e) => + { + btnConfirm.IsSelected = true; + }; + btnConfirm.MouseUpEventHandler += (sender, e) => + { + dialog.Close(); + }; + + } + + + + }); + }; + SubscribeAsync3tyIotbind(); } /// <summary> - /// 鎼滅储绗笁鏂硅澶� + /// 璁㈤槄缁戝畾绗笁鏂筰ot璐﹀彿缁撴灉 /// </summary> - private void SearchDevice() + private void SubscribeAsync3tyIotbind() { - var pack = http.Search3tyIotDevice(brand_Iot.companyId); - if(pack!= null) + 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() -- Gitblit v1.8.0