using System;
|
using System.Collections.Generic;
|
using System.Text;
|
using ZigBee.Device;
|
|
namespace Shared.Phone.UserCenter.GatewayManage
|
{
|
/// <summary>
|
/// 重新绑定网关的界面
|
/// </summary>
|
public class GatewayRebindForm : EditorCommonForm
|
{
|
#region ■ 变量声明___________________________
|
|
#endregion
|
|
#region ■ 初始化_____________________________
|
|
/// <summary>
|
/// 画面显示(底层会固定调用此方法,借以完成画面创建)
|
/// </summary>
|
/// <param name="i_gateway">换绑的网关对象</param>
|
/// <param name="i_dicZbGatewayDiv">搜索到的网关类别 0:第一次绑定 1:已经绑定 2:需要换绑</param>
|
public void ShowForm(ZbGateway i_gateway, Dictionary<string, int> i_dicZbGatewayDiv)
|
{
|
//设置头部信息
|
base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uAddGateway));
|
|
var btnLoading = new LoadingControl();
|
btnLoading.Y = Application.GetRealHeight(656);
|
btnLoading.Gravity = Gravity.CenterHorizontal;
|
bodyFrameLayout.AddChidren(btnLoading);
|
btnLoading.StartAction();
|
|
//正在换绑网关,请稍候…
|
var btnMsg = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(60), false);
|
btnMsg.Y = Application.GetRealHeight(979);
|
btnMsg.TextAlignment = TextAlignment.Center;
|
btnMsg.TextColor = UserCenterColor.Current.TextGrayColor3;
|
btnMsg.TextID = R.MyInternationalizationString.uIsReBindingPleaseWaiting;
|
bodyFrameLayout.AddChidren(btnMsg);
|
|
HdlThreadLogic.Current.RunThread(() =>
|
{
|
System.Threading.Thread.Sleep(1000);
|
int value = HdlGatewayLogic.Current.ReBindNewGateway(i_gateway, btnMsg);
|
if (value == 1)
|
{
|
//成功
|
i_dicZbGatewayDiv[i_gateway.GwId] = 1;
|
//我觉得这里需要获取一下新网关的设备列表
|
HdlDeviceCommonLogic.Current.SetDeviceToMemmoryByGateway(i_gateway.GwId, true);
|
if (i_gateway.IsMainGateWay == true)
|
{
|
//如果它是主网关,则刷新场景列表
|
HdlSceneLogic.Current.RefreshSceneUIList(true);
|
}
|
}
|
else if (value == 0)
|
{
|
//网关绑定在当前账号下的其他住宅里\r\n请解除绑定后再试
|
string msg = Language.StringByID(R.MyInternationalizationString.uTheGatewayInOtherResidenceMsg);
|
if (msg.Contains("{0}") == true)
|
{
|
msg = string.Format(msg, "\r\n");
|
}
|
this.ShowMassage(ShowMsgType.Tip, msg);
|
}
|
|
HdlThreadLogic.Current.RunMain(() =>
|
{
|
//成功或者失败都关闭界面
|
this.CloseForm();
|
});
|
});
|
}
|
|
#endregion
|
}
|
}
|