| | |
| | | /// <summary>
|
| | | /// 设备备注的控件
|
| | | /// </summary>
|
| | | private FrameCaptionInputControl btnDeviceName = null;
|
| | | private FrameCaptionInputControl frameDeviceName = null;
|
| | | /// <summary>
|
| | | /// 设备的某一回路
|
| | | /// </summary>
|
| | |
| | | var btnFinish = new BottomClickButton();
|
| | | btnFinish.TextID = R.MyInternationalizationString.uSave;
|
| | | bodyFrameLayout.AddChidren(btnFinish);
|
| | | btnFinish.ButtonClickEvent += async (sender, e) =>
|
| | | btnFinish.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | //记录起当前正在操作的回路名字
|
| | | dicDeviceSaveName[nowSelectDevice.DeviceEpoint] = btnDeviceName.Text.Trim();
|
| | | dicDeviceSaveName[nowSelectDevice.DeviceEpoint] = frameDeviceName.Text.Trim();
|
| | | foreach (var epoint in dicDeviceSaveName.Keys)
|
| | | {
|
| | | var device = Common.LocalDevice.Current.GetDevice(deviceObj.DeviceAddr, epoint);
|
| | | var device = HdlDeviceCommonLogic.Current.GetDevice(deviceObj.DeviceAddr, epoint);
|
| | | if (device == null || dicDeviceSaveName[epoint] == string.Empty)
|
| | | {
|
| | | //不能允许空白名字
|
| | | continue;
|
| | | }
|
| | | string newName = dicDeviceSaveName[epoint];
|
| | | string oldName = Common.LocalDevice.Current.GetDeviceEpointName(device);
|
| | | string oldName = HdlDeviceCommonLogic.Current.GetDeviceEpointName(device);
|
| | | if (oldName != newName)
|
| | | {
|
| | | //设备名称修改
|
| | | var result = await Common.LocalDevice.Current.ReName(device, newName);
|
| | | var result = HdlDeviceCommonLogic.Current.ReName(device, newName);
|
| | | if (result == false)
|
| | | {
|
| | | return;
|
| | |
| | | //关闭自身
|
| | | this.CloseForm();
|
| | | };
|
| | | //如果当前是展示模板,则不能编辑
|
| | | if (Common.Config.Instance.Home.IsShowTemplate == true)
|
| | | {
|
| | | btnFinish.CanClick = false;
|
| | | }
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | |
| | |
|
| | | //回路备注
|
| | | string caption = Language.StringByID(R.MyInternationalizationString.uDeviceEpointNote);
|
| | | string nameValue = Common.LocalDevice.Current.GetDeviceEpointName(nowSelectDevice);
|
| | | string nameValue = HdlDeviceCommonLogic.Current.GetDeviceEpointName(nowSelectDevice);
|
| | | if (dicDeviceSaveName.ContainsKey(nowSelectDevice.DeviceEpoint) == true)
|
| | | {
|
| | | nameValue = dicDeviceSaveName[nowSelectDevice.DeviceEpoint];
|
| | | }
|
| | |
|
| | | this.btnDeviceName = new FrameCaptionInputControl(caption, nameValue, listview.rowSpace / 2);
|
| | | listview.AddChidren(btnDeviceName);
|
| | | btnDeviceName.InitControl();
|
| | | btnDeviceName.AddBottomLine();
|
| | | btnDeviceName.txtInput.FinishInputEvent += async () =>
|
| | | this.frameDeviceName = new FrameCaptionInputControl(caption, nameValue, listview.rowSpace / 2);
|
| | | this.frameDeviceName.txtInput.MaxByte = 48;//限制只能输入48个字节
|
| | | listview.AddChidren(frameDeviceName);
|
| | | frameDeviceName.InitControl();
|
| | | frameDeviceName.AddBottomLine();
|
| | | //如果当前是展示模板,则需要处理
|
| | | if (Common.Config.Instance.Home.IsShowTemplate == false)
|
| | | {
|
| | | string oldName = Common.LocalDevice.Current.GetDeviceEpointName(nowSelectDevice);
|
| | | if (btnDeviceName.Text.Trim() == string.Empty)
|
| | | frameDeviceName.txtInput.FinishInputEvent += () =>
|
| | | {
|
| | | //将名字还原
|
| | | btnDeviceName.Text = oldName;
|
| | | }
|
| | | if (oldName != btnDeviceName.Text.Trim())
|
| | | {
|
| | | //设备名称修改
|
| | | var result = await Common.LocalDevice.Current.ReName(nowSelectDevice, btnDeviceName.Text.Trim());
|
| | | if (result == false)
|
| | | string oldName = HdlDeviceCommonLogic.Current.GetDeviceEpointName(nowSelectDevice);
|
| | | if (frameDeviceName.Text.Trim() == string.Empty)
|
| | | {
|
| | | return;
|
| | | //将名字还原
|
| | | frameDeviceName.Text = oldName;
|
| | | }
|
| | | //回路备注修改成功!
|
| | | string msg = Language.StringByID(R.MyInternationalizationString.uDeviceEpointReNoteSuccess);
|
| | | this.ShowMassage(ShowMsgType.Tip, msg);
|
| | | }
|
| | | };
|
| | | if (oldName != frameDeviceName.Text.Trim())
|
| | | {
|
| | | //设备名称修改
|
| | | var result = HdlDeviceCommonLogic.Current.ReName(nowSelectDevice, frameDeviceName.Text.Trim());
|
| | | if (result == false)
|
| | | {
|
| | | return;
|
| | | }
|
| | | //回路备注修改成功!
|
| | | string msg = Language.StringByID(R.MyInternationalizationString.uDeviceEpointReNoteSuccess);
|
| | | this.ShowMassage(ShowMsgType.Tip, msg);
|
| | | }
|
| | | };
|
| | | }
|
| | |
|
| | | //所属区域
|
| | | var rowBeloneArea = new BelongAreaControl(listview.rowSpace / 2);
|
| | |
| | | private void InitTopRightMenu()
|
| | | {
|
| | | //检测此回路是否拥有定位功能
|
| | | if (Common.LocalDevice.Current.DeviceIsCanFixedPosition(nowSelectDevice) == false)
|
| | | if (HdlDeviceCommonLogic.Current.DeviceIsCanFixedPosition(nowSelectDevice) == false
|
| | | || Common.Config.Instance.Home.IsShowTemplate == true)
|
| | | {
|
| | | return;
|
| | | }
|
| | |
| | | int menuCount = 1;
|
| | | string deviceMenu = string.Empty;
|
| | | //检测此回路是否拥有定位功能
|
| | | bool canTest = Common.LocalDevice.Current.DeviceIsCanFixedPosition(nowSelectDevice);
|
| | | bool canTest = HdlDeviceCommonLogic.Current.DeviceIsCanFixedPosition(nowSelectDevice);
|
| | | //if (canTest == true)
|
| | | //{
|
| | | // menuCount = 2;
|
| | |
| | | frame.AddRowMenu(deviceMenu, "Item/FixedPosition.png", "Item/FixedPositionSelected.png", () =>
|
| | | {
|
| | | //发送定位功能
|
| | | Common.LocalDevice.Current.SetFixedPositionCommand(nowSelectDevice);
|
| | | HdlDeviceCommonLogic.Current.SetFixedPositionCommand(nowSelectDevice);
|
| | | });
|
| | | }
|
| | |
|
| | |
| | | //计算真实高度
|
| | | int realHeight = this.GetPictrueRealSize(58 + 58);//上下间距
|
| | | realHeight += frameBack.ChildrenCount * this.GetPictrueRealSize(124);//圆圈高度
|
| | | realHeight += (frameBack.ChildrenCount-1) * this.GetPictrueRealSize(60);//圆圈间距
|
| | | realHeight += (frameBack.ChildrenCount - 1) * this.GetPictrueRealSize(60);//圆圈间距
|
| | | if (realHeight > frameBack.Height)
|
| | | {
|
| | | //变更高度
|
| | |
| | | private List<List<CommonDevice>> GetAllDeviceGroup()
|
| | | {
|
| | | bool hadDevice = false;
|
| | | var listDevice = Common.LocalDevice.Current.GetDevicesByMac(deviceObj.DeviceAddr);
|
| | | var listDevice = HdlDeviceCommonLogic.Current.GetDevicesByMac(deviceObj.DeviceAddr);
|
| | | var listRelay = new List<CommonDevice>();
|
| | | foreach (var device in listDevice)
|
| | | {
|
| | |
| | | //只要同一种类型的
|
| | | continue;
|
| | | }
|
| | |
|
| | | //获取设备属于【简约多功能面板】
|
| | | var deviceEnumInfo = HdlDeviceCommonLogic.Current.GetMyDeviceEnumInfo(listDevice);
|
| | | if (deviceEnumInfo.ConcreteType == DeviceConcreteType.ButtonPanel_SimpleMultifunction)
|
| | | {
|
| | | if (device.Type == DeviceType.TemperatureSensor && device.DeviceEpoint == 1)
|
| | | {
|
| | | //简约多功能面板第1回路是一个绑定温湿度传感器第类型,不是真的温湿度的传感器,需要屏蔽掉
|
| | | continue;
|
| | | }
|
| | | }
|
| | |
|
| | | listRelay.Add(device);
|
| | | if (device.DeviceEpoint == deviceObj.DeviceEpoint)
|
| | | {
|
| | |
| | | }
|
| | | return listIcon;
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 回路选择___________________________
|
| | |
| | | nowSelectControl.TextSize = 13;
|
| | | nowSelectControl.TextColor = UserCenterColor.Current.TextGrayColor3;
|
| | | //记录它的名字
|
| | | dicDeviceSaveName[nowSelectDevice.DeviceEpoint] = btnDeviceName.Text.Trim();
|
| | | dicDeviceSaveName[nowSelectDevice.DeviceEpoint] = frameDeviceName.Text.Trim();
|
| | | }
|
| | | //选择状态
|
| | | nowContr.BorderColor = 0xfffb744a;
|
| | |
| | | nowContr.TextColor = UserCenterColor.Current.TextColor1;
|
| | |
|
| | | nowSelectControl = nowContr;
|
| | | nowSelectDevice = Common.LocalDevice.Current.GetDevice(deviceObj.DeviceAddr, Convert.ToInt32(nowContr.Name.Replace("btn", string.Empty)));
|
| | | nowSelectDevice = HdlDeviceCommonLogic.Current.GetDevice(deviceObj.DeviceAddr, Convert.ToInt32(nowContr.Name.Replace("btn", string.Empty)));
|
| | |
|
| | | //重新初始化菜单行
|
| | | this.InitMenuRow();
|