| | |
| | | //添加【按键设置】行(面板专用)
|
| | | this.AddPanelSettionRow();
|
| | | }
|
| | | //方悦新风面板没有功能设置
|
| | | if (deviceEnumInfo.ConcreteType != DeviceConcreteType.ButtonPanel_FangyueFreshAir)
|
| | | //检测能否显示功能设置的菜单
|
| | | if (this.CheckCanShowFunctionSettionRow() == true)
|
| | | {
|
| | | //添加【功能设置】行
|
| | | this.AddFunctionSettionRow();
|
| | |
| | | //只有回路数大于1才能有这个菜单
|
| | | if (Common.LocalDevice.Current.GetDevicesCountByMac(listNewDevice[0].DeviceAddr) == 1)
|
| | | {
|
| | | //要求新风小模块的新风有功能设置
|
| | | if (deviceEnumInfo.ConcreteType != DeviceConcreteType.Relay_FangyueFreshAirModul)
|
| | | {
|
| | | return;
|
| | | }
|
| | | }
|
| | | if (deviceEnumInfo.ConcreteType == DeviceConcreteType.ButtonPanel_FangyueEnvironment
|
| | | || deviceEnumInfo.ConcreteType == DeviceConcreteType.ButtonPanel_FangyueFreshAir)
|
| | |
| | | //不是空气开关
|
| | | return;
|
| | | }
|
| | |
|
| | | //功能类型
|
| | | string caption = Language.StringByID(R.MyInternationalizationString.uFunctionType);
|
| | | var DfunctionType = this.listNewDevice[0].DfunctionType;
|
| | |
|
| | | //功能类型的翻译名字
|
| | | int nowSelectNo = 1;
|
| | | string strType = string.Empty;
|
| | | if (DfunctionType == DeviceFunctionType.A灯光)
|
| | | {
|
| | | strType = Language.StringByID(R.MyInternationalizationString.uLight);
|
| | | nowSelectNo = 1;
|
| | | }
|
| | | else if (DfunctionType == DeviceFunctionType.A开关)
|
| | | {
|
| | | strType = Language.StringByID(R.MyInternationalizationString.uSwitch);
|
| | | nowSelectNo = 0;
|
| | | }
|
| | | else if (DfunctionType == DeviceFunctionType.A插座)
|
| | | {
|
| | | strType = Language.StringByID(R.MyInternationalizationString.uSocket1);
|
| | | nowSelectNo = 2;
|
| | | }
|
| | |
|
| | | var btnFunction = new FrameCaptionViewControl(caption, strType, listview.rowSpace / 2);
|
| | | btnFunction.UseClickStatu = true;
|
| | | listview.AddChidren(btnFunction);
|
| | | btnFunction.InitControl();
|
| | | //自定义功能类型控件
|
| | | var rowFunction = new DeviceFunctionTypeRowControl(this.listNewDevice[0], listview.rowSpace / 2);
|
| | | listview.AddChidren(rowFunction);
|
| | | rowFunction.InitControl();
|
| | | //底线
|
| | | btnFunction.AddBottomLine();
|
| | | //右箭头
|
| | | btnFunction.AddRightArrow();
|
| | | btnFunction.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | //显示列表
|
| | | var listText = new List<string>();
|
| | | listText.Add(Language.StringByID(R.MyInternationalizationString.uSwitch));//开关
|
| | | listText.Add(Language.StringByID(R.MyInternationalizationString.uLight));//灯光
|
| | | listText.Add(Language.StringByID(R.MyInternationalizationString.uSocket1));//插座
|
| | | //标题:选择功能类型
|
| | | var title = Language.StringByID(R.MyInternationalizationString.uSelectFunctionType);
|
| | |
|
| | | var form = new BottomItemSelectForm();
|
| | | form.CancelCallEvent = true;//允许取消
|
| | | form.AddForm(title, listText, nowSelectNo);
|
| | | form.FinishSelectEvent += (selectNo) =>
|
| | | {
|
| | | if (selectNo == -1)
|
| | | {
|
| | | //选择取消
|
| | | btnFunction.Text = string.Empty;
|
| | | }
|
| | | else
|
| | | {
|
| | | btnFunction.Text = listText[selectNo];
|
| | | }
|
| | | nowSelectNo = selectNo;
|
| | | //记录起当前选择的功能类型
|
| | | if (selectNo == 0)
|
| | | {
|
| | | this.listNewDevice[0].DfunctionType = DeviceFunctionType.A开关;
|
| | | if (this.listNewDevice[0].IsCustomizeImage == false)
|
| | | {
|
| | | //重新设置图片
|
| | | this.listNewDevice[0].IconPath = "Device/Switch.png";
|
| | | }
|
| | | }
|
| | | else if (selectNo == 1)
|
| | | {
|
| | | this.listNewDevice[0].DfunctionType = DeviceFunctionType.A灯光;
|
| | | if (this.listNewDevice[0].IsCustomizeImage == false)
|
| | | {
|
| | | //重新设置图片
|
| | | this.listNewDevice[0].IconPath = "Device/Light.png";
|
| | | }
|
| | | }
|
| | | else if (selectNo == 2)
|
| | | {
|
| | | this.listNewDevice[0].DfunctionType = DeviceFunctionType.A插座;
|
| | | if (this.listNewDevice[0].IsCustomizeImage == false)
|
| | | {
|
| | | //重新设置图片
|
| | | this.listNewDevice[0].IconPath = "Device/Socket1.png";
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | | this.listNewDevice[0].DfunctionType = DeviceFunctionType.A未定义;
|
| | | if (this.listNewDevice[0].IsCustomizeImage == false)
|
| | | {
|
| | | //重新设置图片
|
| | | this.listNewDevice[0].IconPath = "Device/Switch.png";
|
| | | }
|
| | | }
|
| | | this.listNewDevice[0].ReSave();
|
| | | };
|
| | | };
|
| | | rowFunction.AddBottomLine();
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
| | | });
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 检测能否显示功能设置的菜单
|
| | | /// </summary>
|
| | | /// <returns></returns>
|
| | | private bool CheckCanShowFunctionSettionRow()
|
| | | {
|
| | | //方悦新风面板没有功能设置
|
| | | if (deviceEnumInfo.ConcreteType == DeviceConcreteType.ButtonPanel_FangyueFreshAir
|
| | | || deviceEnumInfo.ConcreteType == DeviceConcreteType.ButtonPanel_FourButtonScene
|
| | | || deviceEnumInfo.ConcreteType == DeviceConcreteType.ButtonPanel_TwoButtonCurtain)
|
| | | {
|
| | | return false;
|
| | | }
|
| | | return true;
|
| | | }
|
| | |
|
| | | #endregion
|
| | | }
|
| | | }
|