using 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>
|
/// 订阅绑定第三方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>
|
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)
|
{
|
|
}
|
}
|
|
}
|
}
|