| | |
| | | //设置标题信息
|
| | | base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uAddDevice));
|
| | |
|
| | | this.gatewayId = HdlGatewayResourse.NowSelectGatewayId;
|
| | | this.gatewayId = GatewayResourse.NowSelectGatewayId;
|
| | | HdlGatewayLogic.Current.GetRealGateway(ref this.realGateway, this.gatewayId);
|
| | |
|
| | | //初始化中部控件
|
| | |
| | | return;
|
| | | }
|
| | | //根据设备Type创建对应的设备对象
|
| | | var device = HdlDeviceCommonLogic.Current.NewDeviceObjectByDeviceId((DeviceType)jobject.Value<int>("Device_ID"), jobject.Value<int>("Epoint"));
|
| | | var device = Common.LocalDevice.Current.NewDeviceObjectByDeviceId((DeviceType)jobject.Value<int>("Device_ID"), jobject.Value<int>("Epoint"));
|
| | | if (device == null)
|
| | | {
|
| | | return;
|
| | |
| | | device.DeviceInfo = info;
|
| | |
|
| | | //给新设备设置主键属性
|
| | | HdlDeviceCommonLogic.Current.SetNewDeviceMainKeys(device, jobject);
|
| | | Common.LocalDevice.Current.SetNewDeviceMainKeys(device, jobject);
|
| | | device.CurrentGateWayId = this.realGateway.GwId;
|
| | | //将DeviceInfo的属性设置到主属性中
|
| | | HdlDeviceCommonLogic.Current.SetDeviceInfoToMain(device, device);
|
| | | Common.LocalDevice.Current.SetDeviceInfoToMain(device, device);
|
| | |
|
| | | //添加设备的缓存
|
| | | device.IsOnline = 1;
|
| | | HdlDeviceCommonLogic.Current.AddDeviceToMemory(ref device);
|
| | | Common.LocalDevice.Current.AddDeviceToMemory(ref device);
|
| | |
|
| | | //刷新超时时间
|
| | | this.waitDeviceTimeOut = 20;
|
| | |
| | | device.ReSave();
|
| | |
|
| | | //设置设备功能类型 (不能在接收回路的地方写入,不然网关可能会超负荷)
|
| | | HdlDeviceCommonLogic.Current.RefreshDeviceFunctionType(device, device, true);
|
| | | Common.LocalDevice.Current.RefreshDeviceFunctionType(device, device, true);
|
| | | System.Threading.Thread.Sleep(200);
|
| | | //获取设备的固定属性
|
| | | if (HdlDeviceAttributeLogic.Current.ReadDeviceAllFixedAttribute(device) == true)
|
| | | if (HdlDeviceFixedAttributeLogic.Current.SetAllFixedAttributeToDevice(device) == true)
|
| | | {
|
| | | System.Threading.Thread.Sleep(200);
|
| | | }
|
| | |
| | | if (this.targetFormId != string.Empty)
|
| | | {
|
| | | //再关闭设备入网指导界面
|
| | | HdlFormLogic.Current.CloseFormByFormName(this.targetFormId);
|
| | | this.CloseFormByFormName(this.targetFormId);
|
| | | }
|
| | |
|
| | | //添加设备
|