| | |
| | | /// </summary>
|
| | | private void AddFunctionTypeRowByAdmin(NormalViewControl btnBelongType)
|
| | | {
|
| | | //如果是继电器,空气开关,调光器的话
|
| | | if (device.Type == DeviceType.OnOffOutput || device.Type == DeviceType.DimmableLight
|
| | | || device.Type == DeviceType.ColorDimmableLight || device.Type == DeviceType.AirSwitch)
|
| | | //自定义功能类型控件
|
| | | var rowFunction = new DeviceFunctionTypeRowControl(device, listview.rowSpace / 2);
|
| | | if (rowFunction.CanShowRow == true)
|
| | | {
|
| | | //功能类型的翻译名字
|
| | | int nowSelectNo = 1;
|
| | | string strType = string.Empty;
|
| | | if (this.device.DfunctionType == DeviceFunctionType.A灯光)
|
| | | {
|
| | | strType = Language.StringByID(R.MyInternationalizationString.uLight);
|
| | | nowSelectNo = 1;
|
| | | }
|
| | | else if (this.device.DfunctionType == DeviceFunctionType.A开关)
|
| | | {
|
| | | strType = Language.StringByID(R.MyInternationalizationString.uSwitch);
|
| | | nowSelectNo = 0;
|
| | | }
|
| | | else if (this.device.DfunctionType == DeviceFunctionType.A插座)
|
| | | {
|
| | | strType = Language.StringByID(R.MyInternationalizationString.uSocket1);
|
| | | nowSelectNo = 2;
|
| | | }
|
| | | //功能类型
|
| | | var btnFunction = new FrameCaptionViewControl(Language.StringByID(R.MyInternationalizationString.uFunctionType), strType, listview.rowSpace / 2);
|
| | | btnFunction.UseClickStatu = false;
|
| | | listview.AddChidren(btnFunction);
|
| | | btnFunction.InitControl();
|
| | | listview.AddChidren(rowFunction);
|
| | | rowFunction.InitControl();
|
| | | //底线
|
| | | btnFunction.AddBottomLine();
|
| | | //如果是空气开关和继电器,才能修改
|
| | | if (device.Type == DeviceType.OnOffOutput || device.Type == DeviceType.AirSwitch)
|
| | | rowFunction.AddBottomLine();
|
| | | rowFunction.FinishSelectEvent += (index) =>
|
| | | {
|
| | | //右箭头
|
| | | 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.SelectRowCanCancel = false;//选择的不能取消
|
| | | form.AddForm(title, listText, nowSelectNo);
|
| | | form.FinishSelectEvent += (selectNo) =>
|
| | | {
|
| | | btnFunction.Text = listText[selectNo];
|
| | | //当类型变更时,头上的类型也一起变更
|
| | | btnBelongType.Text = listText[selectNo];
|
| | | nowSelectNo = selectNo;
|
| | | //记录起当前选择的功能类型
|
| | | if (selectNo == 0)
|
| | | {
|
| | | this.device.DfunctionType = DeviceFunctionType.A开关;
|
| | | if (this.device.IsCustomizeImage == false)
|
| | | {
|
| | | //重新设置图片
|
| | | this.device.IconPath = "Device/Switch.png";
|
| | | }
|
| | | }
|
| | | else if (selectNo == 1)
|
| | | {
|
| | | this.device.DfunctionType = DeviceFunctionType.A灯光;
|
| | | if (this.device.IsCustomizeImage == false)
|
| | | {
|
| | | //重新设置图片
|
| | | this.device.IconPath = "Device/Light.png";
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | | this.device.DfunctionType = DeviceFunctionType.A插座;
|
| | | if (this.device.IsCustomizeImage == false)
|
| | | {
|
| | | //重新设置图片
|
| | | this.device.IconPath = "Device/Socket1.png";
|
| | | }
|
| | | }
|
| | | this.device.ReSave();
|
| | | };
|
| | | };
|
| | | }
|
| | | }
|
| | |
|
| | | //如果是新风
|
| | | if (device.Type == DeviceType.FreshAir)
|
| | | {
|
| | | //功能类型
|
| | | string caption = Language.StringByID(R.MyInternationalizationString.uFunctionType);
|
| | | string strType = Language.StringByID(R.MyInternationalizationString.FreshAir);
|
| | | var btnFunction = new FrameCaptionViewControl(caption, strType, listview.rowSpace / 2);
|
| | | btnFunction.UseClickStatu = false;
|
| | | listview.AddChidren(btnFunction);
|
| | | btnFunction.InitControl();
|
| | | //底线
|
| | | btnFunction.AddBottomLine();
|
| | | //当类型变更时,头上的类型也一起变更
|
| | | btnBelongType.Text = rowFunction.Text;
|
| | | };
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | /// </summary>
|
| | | private void AddFunctionTypeRowByMember()
|
| | | {
|
| | | //如果是继电器,空气开关,调光器的话
|
| | | if (device.Type == DeviceType.OnOffOutput || device.Type == DeviceType.DimmableLight
|
| | | || device.Type == DeviceType.ColorDimmableLight || device.Type == DeviceType.AirSwitch)
|
| | | //自定义功能类型控件
|
| | | var rowFunction = new DeviceFunctionTypeRowControl(device, listview.rowSpace / 2);
|
| | | if (rowFunction.CanShowRow == true)
|
| | | {
|
| | | //功能类型的翻译名字
|
| | | string strType = string.Empty;
|
| | | if (this.device.DfunctionType == DeviceFunctionType.A灯光)
|
| | | {
|
| | | strType = Language.StringByID(R.MyInternationalizationString.uLight);
|
| | | }
|
| | | else if (this.device.DfunctionType == DeviceFunctionType.A开关)
|
| | | {
|
| | | strType = Language.StringByID(R.MyInternationalizationString.uSwitch);
|
| | | }
|
| | | else if (this.device.DfunctionType == DeviceFunctionType.A插座)
|
| | | {
|
| | | strType = Language.StringByID(R.MyInternationalizationString.uSocket1);
|
| | | }
|
| | |
|
| | | //功能类型
|
| | | var btnFunction = new FrameCaptionViewControl(Language.StringByID(R.MyInternationalizationString.uFunctionType), strType, listview.rowSpace / 2);
|
| | | btnFunction.UseClickStatu = false;
|
| | | listview.AddChidren(btnFunction);
|
| | | btnFunction.InitControl();
|
| | | //强制干涉不能选择
|
| | | rowFunction.SetCanSelect = false;
|
| | | listview.AddChidren(rowFunction);
|
| | | rowFunction.InitControl();
|
| | | //底线
|
| | | btnFunction.AddBottomLine();
|
| | | rowFunction.AddBottomLine();
|
| | | }
|
| | | }
|
| | |
|