| | |
| | | listNewDevice.Add(Common.LocalDevice.Current.GetOTADevice(deviceMac));
|
| | | }
|
| | |
|
| | | //添加新设备的话,主页需要重新刷新
|
| | | UserView.UserPage.Instance.RefreshAllForm = true;
|
| | |
|
| | | //设置标题信息
|
| | | base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uAddDevice));
|
| | |
|
| | |
| | | this.SetAllEpointName();
|
| | | // 设置网关所在的时区的时间给门锁时间
|
| | | this.SetDoorTime();
|
| | | //新入网的设备,清空掉它的房间
|
| | | this.ClearDeviceFromRoom();
|
| | | //添加设备的时候,关闭左划菜单的未分配界面
|
| | | MainPage.LeftListRoomViewFrom.Instance?.CloseUnallocatedRoomForm();
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | |
| | | string caption = Language.StringByID(R.MyInternationalizationString.uDeviceNote);
|
| | | string deviceName = Common.LocalDevice.Current.GetDeviceMacName(listNewDevice[0]);
|
| | | this.btnNote = new FrameCaptionInputControl(caption, deviceName, listview.rowSpace / 2);
|
| | | this.btnNote.txtInput.MaxByte = 48;//限制只能输入48个字节
|
| | | listview.AddChidren(btnNote);
|
| | | btnNote.InitControl();
|
| | | //划线
|
| | |
| | | }
|
| | | }
|
| | | //保存设备房间索引
|
| | | Common.LocalDevice.Current.SaveRealDeviceRoomId(this.listNewDevice, roomKeys);
|
| | | HdlRoomLogic.Current.SaveRealDeviceRoomId(this.listNewDevice, roomKeys);
|
| | | };
|
| | |
|
| | | //更多配置
|
| | |
| | | this.saveDefultName = string.Empty;
|
| | | //改名字
|
| | | btnNote.txtInput.FinishInputEvent();
|
| | |
|
| | | this.CloseForm();
|
| | |
|
| | | var form = new DeviceMacInfoEditorForm();
|
| | | form.AddForm(this.listNewDevice[0].DeviceAddr);
|
| | |
| | | /// </summary>
|
| | | /// <param name="i_deviceName">deviceName.</param>
|
| | | /// <param name="mode">是否显示错误</param>
|
| | | private async void DeviceReName(string i_deviceName, ShowErrorMode mode = ShowErrorMode.YES)
|
| | | private void DeviceReName(string i_deviceName, ShowErrorMode mode = ShowErrorMode.YES)
|
| | | {
|
| | | //修改MAC名
|
| | | string deviceName = i_deviceName.Trim();
|
| | | var result = await Common.LocalDevice.Current.ReMacName(this.listNewDevice, deviceName, mode);
|
| | | var result = Common.LocalDevice.Current.ReMacName(this.listNewDevice, deviceName, mode);
|
| | | if (result == false)
|
| | | {
|
| | | return;
|
| | |
| | | /// <summary>
|
| | | /// 设置全部回路的默认名字
|
| | | /// </summary>
|
| | | private async void SetAllEpointName()
|
| | | private void SetAllEpointName()
|
| | | {
|
| | | foreach (var device in this.listNewDevice)
|
| | | {
|
| | |
| | | }
|
| | | //获取端点名字
|
| | | var epointName = Common.LocalDevice.Current.GetDeviceEpointName(device);
|
| | | await Common.LocalDevice.Current.ReName(device, epointName, ShowErrorMode.NO);
|
| | | Common.LocalDevice.Current.ReName(device, epointName, ShowErrorMode.NO);
|
| | | }
|
| | | }
|
| | |
|
| | |
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 一般方法___________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 新入网的设备,清空掉它的房间
|
| | | /// </summary>
|
| | | private void ClearDeviceFromRoom()
|
| | | {
|
| | | foreach (var device in this.listNewDevice)
|
| | | {
|
| | | HdlRoomLogic.Current.DeleteDevice(device);
|
| | | HdlRoomLogic.Current.DeleteLoveDevice(device);
|
| | | }
|
| | | HdlRoomLogic.Current.DeleteRealDeviceFromRoom(this.listNewDevice[0]);
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 画面关闭___________________________
|
| | |
|
| | | /// <summary>
|