| | |
| | | |
| | | 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> |
| | | /// 订阅绑定第三方iot账号结果 |
| | | /// </summary> |
| | | private void SubscribeAsync3tyIotbind() |
| | | { |
| | | new System.Threading.Thread(async () => |
| | | { |
| | | try |
| | | { |
| | | var result = await DAL.Mqtt.MqttClient.SubscribeAsync3tyIotbind(); |
| | | } |
| | | catch { } |
| | | finally |
| | | { |
| | | |
| | | } |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 取消订阅绑定第三方iot账号结果 |
| | | /// </summary> |
| | | private void UnsubscribeAsync3tyIotbind() |
| | | { |
| | | new System.Threading.Thread(async () => |
| | | { |
| | | try |
| | | { |
| | | var result = await DAL.Mqtt.MqttClient.UnsubscribeAsync3tyIotbind(); |
| | | } |
| | | catch { } |
| | | finally |
| | | { |
| | | |
| | | } |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | } |
| | | /// <summary> |
| | | /// 搜索第三方设备 |
| | | /// </summary> |