| | |
| | | /// <summary>
|
| | | /// 设备备注的控件
|
| | | /// </summary>
|
| | | private FrameCaptionInputControl btnDeviceName = null;
|
| | | private FrameCaptionInputControl frameDeviceName = null;
|
| | | /// <summary>
|
| | | /// 设备的某一回路
|
| | | /// </summary>
|
| | |
| | | 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);
|
| | |
| | | //关闭自身
|
| | | this.CloseForm();
|
| | | };
|
| | | //如果当前是展示模板,则不能编辑
|
| | | if (Common.Config.Instance.Home.IsShowTemplate == true)
|
| | | {
|
| | | btnFinish.CanClick = false;
|
| | | }
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | |
| | | nameValue = dicDeviceSaveName[nowSelectDevice.DeviceEpoint];
|
| | | }
|
| | |
|
| | | this.btnDeviceName = new FrameCaptionInputControl(caption, nameValue, listview.rowSpace / 2);
|
| | | listview.AddChidren(btnDeviceName);
|
| | | btnDeviceName.InitControl();
|
| | | btnDeviceName.AddBottomLine();
|
| | | btnDeviceName.txtInput.FinishInputEvent += () =>
|
| | | 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 = Common.LocalDevice.Current.ReName(nowSelectDevice, btnDeviceName.Text.Trim());
|
| | | if (result == false)
|
| | | string oldName = Common.LocalDevice.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 = Common.LocalDevice.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 (Common.LocalDevice.Current.DeviceIsCanFixedPosition(nowSelectDevice) == false
|
| | | || Common.Config.Instance.Home.IsShowTemplate == true)
|
| | | {
|
| | | return;
|
| | | }
|
| | |
| | | nowSelectControl.TextSize = 13;
|
| | | nowSelectControl.TextColor = UserCenterColor.Current.TextGrayColor3;
|
| | | //记录它的名字
|
| | | dicDeviceSaveName[nowSelectDevice.DeviceEpoint] = btnDeviceName.Text.Trim();
|
| | | dicDeviceSaveName[nowSelectDevice.DeviceEpoint] = frameDeviceName.Text.Trim();
|
| | | }
|
| | | //选择状态
|
| | | nowContr.BorderColor = 0xfffb744a;
|