| | |
| | | /// <summary>
|
| | | /// 列表控件
|
| | | /// </summary>
|
| | | private VerticalListControl listview = null;
|
| | | private FrameListControl listview = null;
|
| | | /// <summary>
|
| | | /// 当前选择的设备
|
| | | /// </summary>
|
| | |
| | | /// <summary>
|
| | | /// 设备备注的控件
|
| | | /// </summary>
|
| | | private FrameCaptionInputControl btnDeviceName = null;
|
| | | private FrameCaptionInputControl frameDeviceName = null;
|
| | | /// <summary>
|
| | | /// 设备的某一回路
|
| | | /// </summary>
|
| | |
| | | //清空bodyFrame
|
| | | this.ClearBodyFrame();
|
| | |
|
| | | var listBackControl = new VerticalFrameControl();
|
| | | listBackControl.Height = bodyFrameLayout.Height;
|
| | | bodyFrameLayout.AddChidren(listBackControl);
|
| | |
|
| | | //初始化桌布
|
| | | this.tableContr = new InformationEditorControl();
|
| | | this.listview = tableContr.InitControl(bodyFrameLayout, Language.StringByID(R.MyInternationalizationString.uDeviceEditor), 562, 1175);
|
| | | this.listview = tableContr.InitControl(listBackControl.frameTable, Language.StringByID(R.MyInternationalizationString.uDeviceEditor), 1175);
|
| | |
|
| | | //初始化设备回路图标
|
| | | this.InitDeviceEpointIcon();
|
| | | this.InitDeviceEpointIcon(listBackControl);
|
| | |
|
| | | //保存
|
| | | 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();
|
| | | //开启进度条
|
| | | this.ShowProgressBar();
|
| | | foreach (var epoint in dicDeviceSaveName.Keys)
|
| | |
| | | if (oldName != newName)
|
| | | {
|
| | | //设备名称修改
|
| | | var result = await Common.LocalDevice.Current.ReName(device, newName);
|
| | | var result = Common.LocalDevice.Current.ReName(device, newName);
|
| | | if (result == false)
|
| | | {
|
| | | //关闭
|
| | |
| | | //关闭自身
|
| | | this.CloseForm();
|
| | | };
|
| | | //如果当前是展示模板,则不能编辑
|
| | | if (Common.Config.Instance.Home.IsShowTemplate == true)
|
| | | {
|
| | | btnFinish.CanClick = false;
|
| | | }
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 初始化菜单行
|
| | | /// </summary>
|
| | | private async void InitMenuRow()
|
| | | private void InitMenuRow()
|
| | | {
|
| | | this.listview.RemoveAll();
|
| | |
|
| | |
| | | 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 = Common.LocalDevice.Current.GetDeviceEpointName(nowSelectDevice);
|
| | | if (frameDeviceName.Text.Trim() == string.Empty)
|
| | | {
|
| | | return;
|
| | | //将名字还原
|
| | | frameDeviceName.Text = oldName;
|
| | | }
|
| | | //干接点备注修改成功!
|
| | | string msg = Language.StringByID(R.MyInternationalizationString.uDryContactReNoteSuccess);
|
| | | 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.uDryContactReNoteSuccess);
|
| | | this.ShowMassage(ShowMsgType.Tip, msg);
|
| | | }
|
| | | };
|
| | | }
|
| | |
|
| | | //所属区域
|
| | | var rowBeloneArea = new BelongAreaControl(listview.rowSpace / 2);
|
| | |
| | | rowBeloneArea.SelectRoomEvent += (roomKeys) =>
|
| | | {
|
| | | //变更房间
|
| | | Common.Room.CurrentRoom.ChangedRoom(nowSelectDevice, roomKeys);
|
| | | HdlRoomLogic.Current.ChangedRoom(nowSelectDevice, roomKeys);
|
| | | };
|
| | |
|
| | | //3路继电器或者1路调光器第七回路的配置信息
|
| | |
| | | if (isHdlDevice == true)
|
| | | {
|
| | | //如果是3路继电器或者1路调光器,并且是第七回路的时候,它好像可以改变类型
|
| | | //如果是7路干接点输入输出模块,并且是第七回路的时候,它好像可以改变类型
|
| | | if ((deviceEnumInfo.ConcreteType == DeviceConcreteType.Relay_ThreeLoad && nowSelectDevice.DeviceEpoint == 10)
|
| | | || (deviceEnumInfo.ConcreteType == DeviceConcreteType.DimmableLight_OneLoad && nowSelectDevice.DeviceEpoint == 7))
|
| | | || (deviceEnumInfo.ConcreteType == DeviceConcreteType.DimmableLight_OneLoad && nowSelectDevice.DeviceEpoint == 7)
|
| | | || (deviceEnumInfo.ConcreteType == DeviceConcreteType.Relay_SevenLoadInOutPutDryContact && nowSelectDevice.DeviceEpoint == 7))
|
| | | {
|
| | | //这里先去获取它的干接点类型
|
| | | this.ShowProgressBar();
|
| | | //获取第七回路的配置信息
|
| | | listRelayInfo7 = await HdlDevicePanelLogic.Current.GetDryContactConfigureInfo(nowSelectDevice);
|
| | | listRelayInfo7 = HdlDevicePanelLogic.Current.GetDryContactConfigureInfo(nowSelectDevice);
|
| | | if (listRelayInfo7 == null)
|
| | | {
|
| | | //关闭进度条
|
| | |
| | | //添加背光灯行
|
| | | this.AddBackLightRow();
|
| | | //初始化桌布完成
|
| | | tableContr.FinishInitControl(bodyFrameLayout, this.listview);
|
| | | tableContr.FinishInitControl();
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
| | | private void InitTopRightMenu()
|
| | | {
|
| | | //检测此回路是否拥有定位功能
|
| | | if (Common.LocalDevice.Current.DeviceIsCanFixedPosition(nowSelectDevice) == false)
|
| | | if (Common.LocalDevice.Current.DeviceIsCanFixedPosition(nowSelectDevice) == false
|
| | | || Common.Config.Instance.Home.IsShowTemplate == true)
|
| | | {
|
| | | return;
|
| | | }
|
| | |
| | | var title = Language.StringByID(R.MyInternationalizationString.uSelectDryContactFunction);
|
| | |
|
| | | var form = new BottomItemSelectForm();
|
| | | form.AddForm(title, listText, nowSelectNo);
|
| | | form.FinishSelectEvent += async (selectNo) =>
|
| | | form.AddForm(title, listText, null, nowSelectNo);
|
| | | form.FinishSelectEvent += (selectNo) =>
|
| | | {
|
| | | if (selectNo == nowSelectNo)
|
| | | {
|
| | |
| | | //选择的是传感器输入
|
| | | value = 65535;
|
| | | }
|
| | | var result = await HdlDevicePanelLogic.Current.EditorDryContactThirdFunction((Panel)nowSelectDevice, value);
|
| | | var result = HdlDevicePanelLogic.Current.EditorDryContactThirdFunction((Panel)nowSelectDevice, value);
|
| | | if (result == true)
|
| | | {
|
| | | //重新初始化菜单行,隐藏或者开放绑定目标菜单
|
| | |
| | | }
|
| | | };
|
| | | };
|
| | | //如果当前是展示模板,则不能编辑
|
| | | if (Common.Config.Instance.Home.IsShowTemplate == true)
|
| | | {
|
| | | btnFunction.CanClick = false;
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | var listDevice = Common.LocalDevice.Current.GetDevicesByMac(deviceObj.DeviceAddr);
|
| | | var myType = Common.LocalDevice.Current.GetMyDeviceEnumInfo(listDevice);
|
| | |
|
| | | //欧标2路5A没有背光灯
|
| | | if (myType.ConcreteType == DeviceConcreteType.Relay_ThreeLoad
|
| | | || myType.ConcreteType == DeviceConcreteType.DimmableLight_OneLoad)
|
| | | || myType.ConcreteType == DeviceConcreteType.DimmableLight_OneLoad
|
| | | || myType.ConcreteType == DeviceConcreteType.Relay_NationalThreeLoadTenA
|
| | | || myType.ConcreteType == DeviceConcreteType.Relay_SevenLoadInOutPutDryContact)
|
| | | {
|
| | | //背光灯
|
| | | string caption = Language.StringByID(R.MyInternationalizationString.uBackLight);
|
| | |
| | | btnLight.AddRightArrow();
|
| | | btnLight.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | var form = new DeviceRelay.RelayThreeLoadBackLightSettionForm();
|
| | | form.AddForm(deviceObj.DeviceAddr);
|
| | | if (myType.ConcreteType == DeviceConcreteType.Relay_NationalThreeLoadTenA
|
| | | || myType.ConcreteType == DeviceConcreteType.Relay_SevenLoadInOutPutDryContact)
|
| | | {
|
| | | //国标3路10A继电器小模块 或者 7路干接点输入输出模块
|
| | | var form = new DeviceRelay.RelayNationalBackLightSettionForm();
|
| | | form.AddForm(deviceObj.DeviceAddr);
|
| | | }
|
| | | else
|
| | | {
|
| | | //三路继电器,或者一路调光器
|
| | | var form = new DeviceRelay.RelayThreeLoadBackLightSettionForm();
|
| | | form.AddForm(deviceObj.DeviceAddr);
|
| | | }
|
| | | };
|
| | | }
|
| | | }
|
| | |
| | | /// <summary>
|
| | | /// 初始化设备回路图标
|
| | | /// </summary>
|
| | | private void InitDeviceEpointIcon()
|
| | | private void InitDeviceEpointIcon(VerticalFrameControl listBackControl)
|
| | | {
|
| | | //获取按组分配的设备
|
| | | var listIcon = this.GetAllDeviceGroup();
|
| | |
| | | frameBorder.Width = Application.GetRealWidth(887);
|
| | | frameBorder.Height = Application.GetRealHeight(423);
|
| | | frameBorder.Radius = (uint)Application.GetRealHeight(6);
|
| | | frameBorder.BorderWidth = 1;
|
| | | frameBorder.BorderColor = 0xffd0d0d0;
|
| | | bodyFrameLayout.AddChidren(frameBorder);
|
| | | listBackControl.frameTable.AddChidren(frameBorder);
|
| | |
|
| | | var frameBack = new FrameLayout();
|
| | | frameBack.Height = frameBorder.Height;
|
| | |
| | | //需要滑动控件
|
| | | var listControl = new VerticalScrolViewLayout();
|
| | | listControl.Height = frameBorder.Height;
|
| | | bodyFrameLayout.AddChidren(listControl);
|
| | | listBackControl.frameTable.AddChidren(listControl);
|
| | |
|
| | | listControl.AddChidren(frameBack);
|
| | | }
|
| | |
| | | for (int i = 0; i < listIcon.Count; i++)
|
| | | {
|
| | | var frame = new FrameLayout();
|
| | | frame.Width = Application.GetMinRealAverage(887);
|
| | | frame.Height = Application.GetMinRealAverage(124);
|
| | | frame.Width = this.GetPictrueRealSize(887);
|
| | | frame.Height = this.GetPictrueRealSize(124);
|
| | | frameBack.AddChidren(frame);
|
| | | //初始化一行设备图标
|
| | | this.InitDeviceIconFrame(frame, listIcon[i], ref index);
|
| | |
| | | }
|
| | | else
|
| | | {
|
| | | frame.Y = Application.GetMinRealAverage(58) + (frameBack.ChildrenCount - 1) * (frame.Height + Application.GetMinRealAverage(60));
|
| | | frame.Y = this.GetPictrueRealSize(58) + (frameBack.ChildrenCount - 1) * (frame.Height + this.GetPictrueRealSize(60));
|
| | | }
|
| | | }
|
| | |
|
| | | if (listIcon.Count > 2)
|
| | | {
|
| | | //计算真实高度
|
| | | int realHeight = Application.GetMinRealAverage(58 + 58) + (frameBack.ChildrenCount - 1) * Application.GetMinRealAverage(124 + 60);
|
| | | int realHeight = this.GetPictrueRealSize(58 + 58) + (frameBack.ChildrenCount - 1) * this.GetPictrueRealSize(124 + 60);
|
| | | if (realHeight > frameBack.Height)
|
| | | {
|
| | | //变更高度
|
| | |
| | | {
|
| | | NormalViewControl btnTemp = null;
|
| | | //间距
|
| | | int space = Application.GetMinRealAverage(84);
|
| | | int space = this.GetPictrueRealSize(84);
|
| | | int defultXX = (frame.Width - frame.Height * listDevice.Count - (listDevice.Count - 1) * space) / 2;
|
| | | for (int i = 0; i < listDevice.Count; i++)
|
| | | {
|
| | |
| | | nowSelectControl.TextSize = 13;
|
| | | nowSelectControl.TextColor = UserCenterColor.Current.TextGrayColor3;
|
| | | //记录它的名字
|
| | | dicDeviceSaveName[nowSelectDevice.DeviceEpoint] = btnDeviceName.Text.Trim();
|
| | | dicDeviceSaveName[nowSelectDevice.DeviceEpoint] = frameDeviceName.Text.Trim();
|
| | | }
|
| | | //选择状态
|
| | | nowContr.BorderColor = 0xfffb744a;
|