| | |
| | | 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);
|
| | | }
|
| | | }
|
| | | //保存设备房间索引
|
| | |
| | | }
|
| | | //更改过一次之后,则界面关闭后不再更改
|
| | | 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>
|
| | |
| | | {
|
| | | 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;
|