| | |
| | | public void ShowForm(string deviceMac)
|
| | | {
|
| | | this.listNewDevice = Common.LocalDevice.Current.GetDevicesByMac(deviceMac);
|
| | | if (listNewDevice.Count == 0)
|
| | | {
|
| | | //对应单纯只有200回路的设备
|
| | | listNewDevice.Add(Common.LocalDevice.Current.GetOTADevice(deviceMac));
|
| | | }
|
| | |
|
| | | //设置标题信息
|
| | | base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uAddDevice));
|
| | |
| | | {
|
| | | foreach (var device in this.listNewDevice)
|
| | | {
|
| | | var room = Common.Room.CurrentRoom.GetRoomByDevice(device);
|
| | | if (device is OTADevice)
|
| | | {
|
| | | continue;
|
| | | }
|
| | | var room = HdlRoomLogic.Current.GetRoomByDevice(device);
|
| | | string mainKeys = Common.LocalDevice.Current.GetDeviceMainKeys(device);
|
| | | if (room == null)
|
| | | {
|
| | | //这里有点特殊,如果回路没有设置有区域的时候,才设置
|
| | | listCheck.Add(mainKeys);
|
| | | Common.Room.CurrentRoom.ChangedRoom(device, roomKeys);
|
| | | HdlRoomLogic.Current.ChangedRoom(device, roomKeys);
|
| | | }
|
| | | else if (listCheck.Contains(mainKeys) == true)
|
| | | {
|
| | | //如果这个回路之前都还没有区域,在本界面还没有关闭之前,可以无条件随便变更
|
| | | Common.Room.CurrentRoom.ChangedRoom(device, roomKeys);
|
| | | HdlRoomLogic.Current.ChangedRoom(device, roomKeys);
|
| | | }
|
| | | }
|
| | | //保存设备房间索引
|
| | |
| | | };
|
| | | }
|
| | |
|
| | | #endregion
|
| | | #endregion
|
| | |
|
| | | #region ■ 修改名字___________________________
|
| | | #region ■ 修改名字___________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 设备重命名然后打开新的画面
|
| | |
| | | }
|
| | | //更改过一次之后,则界面关闭后不再更改
|
| | | this.saveDefultName = string.Empty;
|
| | |
|
| | | //如果它的回路只有一个的话,则在设备上报的时候,修改MAC名字之后,连同端点名字也一起修改
|
| | | if (this.listNewDevice.Count == 1)
|
| | | {
|
| | | //修改端点名字
|
| | | result = await Common.LocalDevice.Current.ReName(this.listNewDevice[0], deviceName, mode);
|
| | | if (result == false)
|
| | | {
|
| | | return;
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | |
| | | /// </summary>
|
| | | private async void SetAllEpointName()
|
| | | {
|
| | | var tempValue = Common.LocalDevice.Current.GetDeviceObjectText(this.listNewDevice);
|
| | | var arry = tempValue.Split(new string[] { "(" }, StringSplitOptions.RemoveEmptyEntries);
|
| | | var objName = arry[0].Trim();
|
| | |
|
| | | //获取设备类型
|
| | | var deviceInfoType = Common.LocalDevice.Current.GetMyDeviceEnumInfo(this.listNewDevice);
|
| | | foreach (var device in this.listNewDevice)
|
| | | {
|
| | | if (Common.LocalDevice.Current.GetSimpleEpointName(device) != string.Empty)
|
| | | if ((device is OTADevice) || Common.LocalDevice.Current.GetSimpleEpointName(device) != string.Empty)
|
| | | {
|
| | | //有名字不处理
|
| | | continue;
|
| | | }
|
| | | var epointName = objName;
|
| | | if (this.listNewDevice.Count > 1)
|
| | | {
|
| | | if (deviceInfoType.BeloneType == Common.DeviceBeloneType.A按键面板 && device.Type == DeviceType.TemperatureSensor)
|
| | | {
|
| | | //面板的最后一个回路是温度传感器
|
| | | epointName += Language.StringByID(R.MyInternationalizationString.uDeviceBelongId11);
|
| | | }
|
| | | else if (deviceInfoType.ConcreteType == Common.DeviceConcreteType.Sensor_Pir)
|
| | | {
|
| | | //pir传感器,它又搞特殊东西,传感器自身用自己的名字,继电器回路的话……
|
| | | if (device.Type == DeviceType.OnOffOutput)
|
| | | {
|
| | | epointName += Language.StringByID(R.MyInternationalizationString.uDeviceBelongId2300);
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | | //XXXXX(N回路)
|
| | | epointName += "(" + device.DeviceEpoint + Language.StringByID(R.MyInternationalizationString.uDeviceCircuit) + ")";
|
| | | }
|
| | | }
|
| | | //获取端点名字
|
| | | var epointName = Common.LocalDevice.Current.GetDeviceEpointName(device);
|
| | | await Common.LocalDevice.Current.ReName(device, epointName, ShowErrorMode.NO);
|
| | | }
|
| | | }
|
| | |
|
| | | #endregion
|
| | | #endregion
|
| | |
|
| | | #region ■ 画面关闭___________________________
|
| | | #region ■ 画面关闭___________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 画面关闭
|
| | |
| | |
|
| | | base.CloseFormBefore();
|
| | | }
|
| | | #endregion
|
| | | #endregion
|
| | | }
|
| | | }
|