ZigbeeApp/Shared/Common/CommonPage.cs
@@ -57,7 +57,7 @@ /// <summary> /// 版本号 /// </summary> public static string CodeIDString = "1.0.20042701"; public static string CodeIDString = "1.0.20042801"; /// <summary> /// 注册来源(0:HDL On 1:Zigbee) /// </summary> ZigbeeApp/Shared/Phone/MainPage/DeviceDetailInfoForm.cs
@@ -272,105 +272,19 @@ /// </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; }; } } @@ -379,32 +293,16 @@ /// </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(); } } ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/RowLayoutControls/DeviceFunctionTypeRowControl.cs
@@ -13,11 +13,27 @@ #region ■ 变量声明___________________________ /// <summary> /// 判断该控件能否显示(最好确保设备对象不为null) /// 结束选择的事件 value:索引(从0开始) 文本信息请用Text获取 /// </summary> public Action<int> FinishSelectEvent = null; /// <summary> /// 判断该控件能否显示 /// </summary> public bool CanShowRow { get { return this.CheckCanShowRow(); } } private bool m_SetCanSelect = true; /// <summary> /// 强制设置能否进行选择(只对继电器和空气开关有效,个别界面需要这种操作) /// </summary> public bool SetCanSelect { set { m_SetCanSelect = value; } } /// <summary> /// 设备对象 @@ -33,7 +49,7 @@ #region ■ 初始化_____________________________ /// <summary> /// 设备功能类型的自定义行控件(此方法选择之后,无条件直接变更类型) /// 设备功能类型的自定义行控件(选择功能之后,无条件直接变更类型) /// </summary> /// <param name="i_device">设备的对象</param> /// <param name="i_ChidrenYaxis">子控件Y轴偏移量(真实值,有些界面需要这种特殊操作)</param> @@ -53,25 +69,23 @@ //初始化底层数据 base.InitControl(); if (this.device == null) { //此控件采用的是另外一种初始化方式 return; } //空气开关和继电器可以选择功能类型 if (this.device.Type == DeviceType.AirSwitch || this.device.Type == DeviceType.OnOffOutput) { this.UseClickStatu = true; //右箭头 this.AddRightArrow(); this.ButtonClickEvent += (sender, e) => //没被强制干涉的话 if (m_SetCanSelect == true) { //显示选择设备功能类型的界面 this.ShowSelectDeviceFunctionListForm(); }; this.UseClickStatu = true; //右箭头 this.AddRightArrow(); this.ButtonClickEvent += (sender, e) => { //显示选择设备功能类型的界面 this.ShowSelectDeviceFunctionListForm(); }; } } } @@ -103,6 +117,9 @@ //记录起当前选择的功能类型 this.RefreshDfunctionType(); //调用回调函数 this.FinishSelectEvent?.Invoke(nowSelectNo); }; } #endregion @@ -117,12 +134,7 @@ //标题:功能类型 this.btnCaption.Text = Language.StringByID(R.MyInternationalizationString.uFunctionType); var myFunType = DeviceFunctionType.A未定义; if (this.device != null) { myFunType = this.device.DfunctionType; } var myFunType = this.device.DfunctionType; //功能类型的翻译名字 string strType = string.Empty; if (myFunType == DeviceFunctionType.A灯光) @@ -141,35 +153,38 @@ nowSelectNo = 2; } //如果设备不为null if (this.device != null) if (this.device.Type == DeviceType.ColorDimmableLight || this.device.Type == DeviceType.DimmableLight) { if (this.device.Type == DeviceType.ColorDimmableLight || this.device.Type == DeviceType.DimmableLight) { //灯光类固定为 灯光 strType = Language.StringByID(R.MyInternationalizationString.uLight); nowSelectNo = 1; } else if (this.device.Type == DeviceType.WindowCoveringDevice) { //窗帘固定为 遮阳 strType = Language.StringByID(R.MyInternationalizationString.uDeviceBelongId100); nowSelectNo = -1; } else if (this.device.Type == DeviceType.Thermostat) { //空调固定为 空调 strType = Language.StringByID(R.MyInternationalizationString.uDeviceBelongId3600); nowSelectNo = -1; } else if (this.device.Type == DeviceType.DoorLock) { //门锁固定为 门锁 strType = Language.StringByID(R.MyInternationalizationString.uDeviceBelongId2800); nowSelectNo = -1; } //灯光类固定为 灯光 strType = Language.StringByID(R.MyInternationalizationString.uLight); nowSelectNo = 1; } else if (this.device.Type == DeviceType.WindowCoveringDevice) { //窗帘固定为 遮阳 strType = Language.StringByID(R.MyInternationalizationString.uDeviceBelongId100); nowSelectNo = -1; } else if (this.device.Type == DeviceType.Thermostat) { //空调固定为 空调 strType = Language.StringByID(R.MyInternationalizationString.uDeviceBelongId3600); nowSelectNo = -1; } else if (this.device.Type == DeviceType.DoorLock) { //门锁固定为 门锁 strType = Language.StringByID(R.MyInternationalizationString.uDeviceBelongId2800); nowSelectNo = -1; } else if (this.device.Type == DeviceType.DoorLock) { //新风固定为 新风 strType = Language.StringByID(R.MyInternationalizationString.FreshAir); nowSelectNo = -1; } //显示文本 this.txtView.Text = strType; } @@ -192,6 +207,7 @@ || this.device.Type == DeviceType.DoorLock//门锁 || this.device.Type == DeviceType.OnOffOutput//继电器 || this.device.Type == DeviceType.Thermostat//空调 || this.device.Type == DeviceType.FreshAir//新风 || this.device.Type == DeviceType.WindowCoveringDevice)//窗帘 { return true; @@ -201,6 +217,20 @@ #endregion #region ■ 控件摧毁___________________________ /// <summary> /// 控件摧毁 /// </summary> public override void RemoveFromParent() { this.FinishSelectEvent = null; base.RemoveFromParent(); } #endregion #region ■ 一般方法___________________________ /// <summary> ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceDoorLockLogic.cs
@@ -38,7 +38,7 @@ /// 添加历史记录 /// </summary> /// <param name="i_doorLock">门锁对象</param> /// <param name="OtherOpenLockMode">其他开锁方式 9001:常开打开 9002:常开取消 9003:常开持续</param> /// <param name="OtherOpenLockMode">其他开锁方式 9001:常开打开 9002:常开取消 9003:常开持续 9004:常开自动化手动取消</param> /// <param name="NormallyOpenContinuedTime">常开持续时间(1~72小时 OtherOpenLockMode=9003的时候有效)</param> public void AddDoorHistoryLog(ZigBee.Device.DoorLock i_doorLock, int OtherOpenLockMode, string NormallyOpenContinuedTime) { ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceFunctionSettionForm.cs
@@ -41,10 +41,6 @@ /// </summary> private Dictionary<int, string> dicDeviceSaveName = new Dictionary<int, string>(); /// <summary> /// 设备需要保存的设备功能 /// </summary> private Dictionary<int, DeviceFunctionType> dicDeviceFuncType = new Dictionary<int, DeviceFunctionType>(); /// <summary> /// 信息编辑控件 /// </summary> private InformationEditorControl tableContr = null; @@ -108,8 +104,6 @@ { //记录起当前正在操作的回路名字 dicDeviceSaveName[nowSelectDevice.DeviceEpoint] = btnDeviceName.Text.Trim(); //开启进度条 this.ShowProgressBar(); foreach (var epoint in dicDeviceSaveName.Keys) { var device = Common.LocalDevice.Current.GetDevice(deviceObj.DeviceAddr, epoint); @@ -126,45 +120,10 @@ var result = await Common.LocalDevice.Current.ReName(device, newName); if (result == false) { //关闭 this.CloseProgressBar(); return; } } } foreach (var epoint in dicDeviceFuncType.Keys) { var device = Common.LocalDevice.Current.GetDevice(deviceObj.DeviceAddr, epoint); if (device == null) { continue; } //设置功能类型 device.DfunctionType = dicDeviceFuncType[epoint]; if (device.IsCustomizeImage == true) { continue; } //重新设置图片 if (device.DfunctionType == DeviceFunctionType.A开关) { device.IconPath = "Device/Switch.png"; } else if (device.DfunctionType == DeviceFunctionType.A插座) { device.IconPath = "Device/Socket1.png"; } else if (device.DfunctionType == DeviceFunctionType.A灯光) { device.IconPath = "Device/Light.png"; } else { device.IconPath = "Device/RelayEpoint.png"; } device.ReSave(); } this.CloseProgressBar(); //关闭自身 this.CloseForm(); }; @@ -295,110 +254,16 @@ /// </summary> private void AddFunctionTypeRow() { //如果是继电器和调光器的话 if (nowSelectDevice.Type == DeviceType.OnOffOutput || nowSelectDevice.Type == DeviceType.DimmableLight || nowSelectDevice.Type == DeviceType.ColorDimmableLight) //自定义功能类型控件 var rowFunction = new DeviceFunctionTypeRowControl(nowSelectDevice, listview.rowSpace / 2); if (rowFunction.CanShowRow == false) { //功能类型 string caption = Language.StringByID(R.MyInternationalizationString.uFunctionType); var DfunctionType = nowSelectDevice.DfunctionType; if (this.dicDeviceFuncType.ContainsKey(nowSelectDevice.DeviceEpoint) == true) { DfunctionType = this.dicDeviceFuncType[nowSelectDevice.DeviceEpoint]; } //功能类型的翻译名字 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 = false; listview.AddChidren(btnFunction); btnFunction.InitControl(); //底线 btnFunction.AddBottomLine(); //如果是继电器才能够更改这个功能类型 if (nowSelectDevice.Type == DeviceType.OnOffOutput) { btnFunction.UseClickStatu = true; //右箭头 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) { dicDeviceFuncType[nowSelectDevice.DeviceEpoint] = DeviceFunctionType.A开关; } else if (selectNo == 1) { dicDeviceFuncType[nowSelectDevice.DeviceEpoint] = DeviceFunctionType.A灯光; } else if (selectNo == 2) { dicDeviceFuncType[nowSelectDevice.DeviceEpoint] = DeviceFunctionType.A插座; } else { dicDeviceFuncType[nowSelectDevice.DeviceEpoint] = DeviceFunctionType.A未定义; } }; }; } return; } //如果是新风 if (nowSelectDevice.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(); } listview.AddChidren(rowFunction); rowFunction.InitControl(); //底线 rowFunction.AddBottomLine(); } #endregion ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceMacInfoEditorForm.cs
@@ -901,9 +901,15 @@ /// </summary> private void AddAirSwitchFunctionTypeRow() { if (this.deviceEnumInfo.BeloneType != DeviceBeloneType.A智能空开) //2020.04.28变更:有个别设备它除了继电器回路,什么都没有了, //这个时候也要现实出来 if (this.listNewDevice.Count != 1) { //不是空气开关 return; } if (this.listNewDevice[0].Type != DeviceType.OnOffOutput && this.listNewDevice[0].Type != DeviceType.AirSwitch) { return; } //自定义功能类型控件 ZigbeeApp/Shared/Phone/UserCenter/Device/DoorLock/DoorLockHistoryLogForm.cs
@@ -395,6 +395,11 @@ //常开模式启用{0}小时 btnMsg.Text = Language.StringByID(R.MyInternationalizationString.uNormallyOpenModeOpenSomeTime).Replace("{0}", historyInfo.NormallyOpenContinuedTime); } else if (historyInfo.OtherOpenLockMode == 9004) { //常开自动化手动取消 btnMsg.Text = Language.StringByID(R.MyInternationalizationString.uNormallyOpenLogicManualClose); } else { //上面是App手动推送,这里是网关或者门锁自己推送 @@ -1104,7 +1109,7 @@ /// </summary> public string CloudAccountId = string.Empty; /// <summary> /// 其他开锁方式(OpenLockMode=9000时有效) 9001:常开打开 9002:常开取消 9003:常开持续 /// 其他开锁方式(OpenLockMode=9000时有效) 9001:常开打开 9002:常开取消 9003:常开持续 9004:常开自动化手动取消 /// </summary> public int? OtherOpenLockMode = -1; /// <summary> ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFunctionSettionForm.cs
@@ -37,10 +37,6 @@ /// </summary> private Dictionary<int, string> dicDeviceSaveName = new Dictionary<int, string>(); /// <summary> /// 设备需要保存的设备功能 /// </summary> private Dictionary<int, DeviceFunctionType> dicDeviceFuncType = new Dictionary<int, DeviceFunctionType>(); /// <summary> /// 信息编辑控件 /// </summary> private InformationEditorControl tableContr = null; @@ -94,8 +90,6 @@ { //记录起当前正在操作的回路名字 dicDeviceSaveName[nowSelectDevice.DeviceEpoint] = btnDeviceName.Text.Trim(); //开启进度条 this.ShowProgressBar(); foreach (var epoint in dicDeviceSaveName.Keys) { var device = Common.LocalDevice.Current.GetDevice(deviceObj.DeviceAddr, epoint); @@ -112,45 +106,10 @@ var result = await Common.LocalDevice.Current.ReName(device, newName); if (result == false) { //关闭 this.CloseProgressBar(); return; } } } foreach (var epoint in dicDeviceFuncType.Keys) { var device = Common.LocalDevice.Current.GetDevice(deviceObj.DeviceAddr, epoint); if (device == null) { continue; } //设置功能类型 device.DfunctionType = dicDeviceFuncType[epoint]; if (device.IsCustomizeImage == true) { continue; } //重新设置图片 if (device.DfunctionType == DeviceFunctionType.A开关) { device.IconPath = "Device/Switch.png"; } else if (device.DfunctionType == DeviceFunctionType.A插座) { device.IconPath = "Device/Socket1.png"; } else if (device.DfunctionType == DeviceFunctionType.A灯光) { device.IconPath = "Device/Light.png"; } else { device.IconPath = "Device/RelayEpoint.png"; } device.ReSave(); } this.CloseProgressBar(); //关闭自身 this.CloseForm(); }; @@ -281,95 +240,14 @@ /// </summary> private void AddFunctionTypeRow() { //如果是继电器和调光器的话 if (nowSelectDevice.Type == DeviceType.OnOffOutput || nowSelectDevice.Type == DeviceType.DimmableLight || nowSelectDevice.Type == DeviceType.ColorDimmableLight) //自定义功能类型控件 var rowFunction = new DeviceFunctionTypeRowControl(nowSelectDevice, listview.rowSpace / 2); if (rowFunction.CanShowRow == true) { //功能类型 string caption = Language.StringByID(R.MyInternationalizationString.uFunctionType); var DfunctionType = nowSelectDevice.DfunctionType; if (this.dicDeviceFuncType.ContainsKey(nowSelectDevice.DeviceEpoint) == true) { DfunctionType = this.dicDeviceFuncType[nowSelectDevice.DeviceEpoint]; } //功能类型的翻译名字 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 = false; listview.AddChidren(btnFunction); btnFunction.InitControl(); listview.AddChidren(rowFunction); rowFunction.InitControl(); //底线 btnFunction.AddBottomLine(); //如果是继电器才能够更改这个功能类型 if (nowSelectDevice.Type == DeviceType.OnOffOutput) { btnFunction.UseClickStatu = true; //右箭头 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) { dicDeviceFuncType[nowSelectDevice.DeviceEpoint] = DeviceFunctionType.A开关; } else if (selectNo == 1) { dicDeviceFuncType[nowSelectDevice.DeviceEpoint] = DeviceFunctionType.A灯光; } else if (selectNo == 2) { dicDeviceFuncType[nowSelectDevice.DeviceEpoint] = DeviceFunctionType.A插座; } else { dicDeviceFuncType[nowSelectDevice.DeviceEpoint] = DeviceFunctionType.A未定义; } }; }; } rowFunction.AddBottomLine(); } } ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFunctionSettionForm.cs
@@ -37,10 +37,6 @@ /// </summary> private Dictionary<int, string> dicDeviceSaveName = new Dictionary<int, string>(); /// <summary> /// 设备需要保存的设备功能 /// </summary> private Dictionary<int, DeviceFunctionType> dicDeviceFuncType = new Dictionary<int, DeviceFunctionType>(); /// <summary> /// 信息编辑控件 /// </summary> private InformationEditorControl tableContr = null; @@ -94,8 +90,6 @@ { //记录起当前正在操作的回路名字 dicDeviceSaveName[nowSelectDevice.DeviceEpoint] = btnDeviceName.Text.Trim(); //开启进度条 this.ShowProgressBar(); foreach (var epoint in dicDeviceSaveName.Keys) { var device = Common.LocalDevice.Current.GetDevice(deviceObj.DeviceAddr, epoint); @@ -112,45 +106,10 @@ var result = await Common.LocalDevice.Current.ReName(device, newName); if (result == false) { //关闭 this.CloseProgressBar(); return; } } } foreach (var epoint in dicDeviceFuncType.Keys) { var device = Common.LocalDevice.Current.GetDevice(deviceObj.DeviceAddr, epoint); if (device == null) { continue; } //设置功能类型 device.DfunctionType = dicDeviceFuncType[epoint]; if (device.IsCustomizeImage == true) { continue; } //重新设置图片 if (device.DfunctionType == DeviceFunctionType.A开关) { device.IconPath = "Device/Switch.png"; } else if (device.DfunctionType == DeviceFunctionType.A插座) { device.IconPath = "Device/Socket1.png"; } else if (device.DfunctionType == DeviceFunctionType.A灯光) { device.IconPath = "Device/Light.png"; } else { device.IconPath = "Device/RelayEpoint.png"; } device.ReSave(); } this.CloseProgressBar(); //关闭自身 this.CloseForm(); }; @@ -281,95 +240,14 @@ /// </summary> private void AddFunctionTypeRow() { //如果是继电器和调光器的话 if (nowSelectDevice.Type == DeviceType.OnOffOutput || nowSelectDevice.Type == DeviceType.DimmableLight || nowSelectDevice.Type == DeviceType.ColorDimmableLight) //自定义功能类型控件 var rowFunction = new DeviceFunctionTypeRowControl(nowSelectDevice, listview.rowSpace / 2); if (rowFunction.CanShowRow == true) { //功能类型 string caption = Language.StringByID(R.MyInternationalizationString.uFunctionType); var DfunctionType = nowSelectDevice.DfunctionType; if (this.dicDeviceFuncType.ContainsKey(nowSelectDevice.DeviceEpoint) == true) { DfunctionType = this.dicDeviceFuncType[nowSelectDevice.DeviceEpoint]; } //功能类型的翻译名字 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 = false; listview.AddChidren(btnFunction); btnFunction.InitControl(); listview.AddChidren(rowFunction); rowFunction.InitControl(); //底线 btnFunction.AddBottomLine(); //如果是继电器才能够更改这个功能类型 if (nowSelectDevice.Type == DeviceType.OnOffOutput) { btnFunction.UseClickStatu = true; //右箭头 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) { dicDeviceFuncType[nowSelectDevice.DeviceEpoint] = DeviceFunctionType.A开关; } else if (selectNo == 1) { dicDeviceFuncType[nowSelectDevice.DeviceEpoint] = DeviceFunctionType.A灯光; } else if (selectNo == 2) { dicDeviceFuncType[nowSelectDevice.DeviceEpoint] = DeviceFunctionType.A插座; } else { dicDeviceFuncType[nowSelectDevice.DeviceEpoint] = DeviceFunctionType.A未定义; } }; }; } rowFunction.AddBottomLine(); } } ZigbeeApp/Shared/R.cs
@@ -5726,6 +5726,11 @@ /// 灯全关 /// </summary> public const int uAllLightClose = 16114; /// <summary> /// 常开自动化手动取消 /// </summary> public const int uNormallyOpenLogicManualClose = 16115; //★★★★下面这些是接口的返回信息翻译,从18000开始★★★★ /// <summary>