| | |
| | | /// </summary>
|
| | | private string gatewayId = string.Empty;
|
| | | /// <summary>
|
| | | /// 真实网关
|
| | | /// </summary>
|
| | | private ZbGateway realGateway = null;
|
| | | /// <summary>
|
| | | /// 进度条
|
| | | /// </summary>
|
| | | private FrameLayout btnProgressBar = null;
|
| | |
| | | base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uAddDevice)); |
| | | |
| | | this.gatewayId = HdlGatewayLogic.Current.GetGatewayId(GatewayResourse.NowSelectGateway); |
| | | HdlGatewayLogic.Current.GetRealGateway(ref this.realGateway, this.gatewayId); |
| | | |
| | | //初始化中部控件 |
| | | this.InitMiddleFrame(); |
| | |
| | | return;
|
| | | }
|
| | | //让网关允许入网
|
| | | GatewayResourse.NowSelectGateway.AddNewDeviceToGateway(255);
|
| | | this.realGateway.AddNewDeviceToGateway(255);
|
| | | System.Threading.Thread.Sleep(1000);
|
| | | }
|
| | | });
|
| | |
|
| | | //添加监视设备新上报的事件
|
| | | GatewayResourse.NowSelectGateway.GwResDataAction += this.AdjustGatewayResultData; |
| | | this.realGateway.GwResDataAction += this.AdjustGatewayResultData; |
| | | }
|
| | |
|
| | | #endregion
|
| | |
| | | if (result == -1)
|
| | | {
|
| | | //停止接收
|
| | | GatewayResourse.NowSelectGateway.GwResDataAction -= this.AdjustGatewayResultData;
|
| | | this.realGateway.GwResDataAction -= this.AdjustGatewayResultData;
|
| | |
|
| | | Application.RunOnMainThread(() =>
|
| | | {
|
| | |
| | |
|
| | | //给新设备设置主键属性
|
| | | Common.LocalDevice.Current.SetNewDeviceMainKeys(device, jobject);
|
| | | device.CurrentGateWayId = HdlGatewayLogic.Current.GetGatewayId(GatewayResourse.NowSelectGateway);
|
| | | device.CurrentGateWayId = HdlGatewayLogic.Current.GetGatewayId(this.realGateway);
|
| | | //将DeviceInfo的属性设置到主属性中
|
| | | Common.LocalDevice.Current.SetDeviceInfoToMain(device, device);
|
| | |
|
| | |
| | | this.waitDeviceTimeOut--;
|
| | | }
|
| | | //停止接收
|
| | | GatewayResourse.NowSelectGateway.GwResDataAction -= this.AdjustGatewayResultData;
|
| | | this.realGateway.GwResDataAction -= this.AdjustGatewayResultData;
|
| | | System.Threading.Thread.Sleep(500);
|
| | |
|
| | | //目前就弄一个
|
| | |
| | | { |
| | | base.CloseForm();
|
| | | //停止接收
|
| | | GatewayResourse.NowSelectGateway.GwResDataAction -= this.AdjustGatewayResultData;
|
| | | this.realGateway.GwResDataAction -= this.AdjustGatewayResultData;
|
| | |
|
| | | HdlThreadLogic.Current.RunThread(() =>
|
| | | {
|
| | | System.Threading.Thread.Sleep(1200);
|
| | | //关闭入网模式
|
| | | GatewayResourse.NowSelectGateway.AddNewDeviceToGateway(0);
|
| | | this.realGateway.AddNewDeviceToGateway(0);
|
| | | });
|
| | | }
|
| | |
|