| | |
| | | /// 初始化控件
|
| | | /// </summary>
|
| | | /// <param name="i_device"></param>
|
| | | public override void InitControl(CommonDevice i_device)
|
| | | public override void InitControl(CommonDevice i_device, Common.Room i_nowSelectRoom)
|
| | | {
|
| | | base.InitControl(i_device);
|
| | | base.InitControl(i_device, i_nowSelectRoom);
|
| | |
|
| | | //添加跳转深度卡片信息事件
|
| | | this.AddDetailInfoEvent(i_device);
|
| | |
| | | var btnSwitch = this.AddSwitchControl();
|
| | | btnSwitch.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | //获取当前亮度
|
| | | int level = Convert.ToInt32(i_device.GetType().InvokeMember("Level", System.Reflection.BindingFlags.GetField, null, i_device, null));
|
| | | //如果住宅为虚拟住宅
|
| | | if (Common.Config.Instance.Home.IsVirtually == true)
|
| | | {
|
| | | //直接变更缓存
|
| | | ((LightBase)i_device).OnOffStatus = btnSwitch.IsSelected == true ? 0 : 1;
|
| | | if (((LightBase)i_device).OnOffStatus == 1 && level == 0)
|
| | | {
|
| | | //如果当前是打开状态,并且亮度为0的话,则需要变成100%亮度
|
| | | i_device.GetType().InvokeMember("Level", System.Reflection.BindingFlags.SetField, null, i_device, new object[] { 100 });
|
| | | }
|
| | | this.RefreshControlInfo(this.device);
|
| | | return;
|
| | | }
|
| | | bool setStatu = !btnSwitch.IsSelected;
|
| | | //变更卡片状态
|
| | | this.SetCardOpenStatu(setStatu);
|
| | |
| | | {
|
| | | //打开
|
| | | this.SetDeviceStatuText(Language.StringByID(R.MyInternationalizationString.uOpen1));
|
| | | i_device.SwitchControl(1);
|
| | | if (level == 0)
|
| | | {
|
| | | //如果当前是打开状态,并且亮度为0的话,则需要变成100%亮度
|
| | | i_device.GetType().InvokeMember("SetLevel", System.Reflection.BindingFlags.InvokeMethod, null, i_device, new object[] { 254 });
|
| | | }
|
| | | else
|
| | | {
|
| | | i_device.SwitchControl(1);
|
| | | HdlThreadLogic.Current.RunThread(() =>
|
| | | {
|
| | | //获取灯光亮度
|
| | | System.Threading.Thread.Sleep(300);
|
| | | HdlDeviceAttributeLogic.Current.SendLevelStatuComand(i_device);
|
| | | });
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | |
| | |
|
| | | //彩灯,调光器类型的深度卡片界面
|
| | | var form = new ControlForm.DeviceColorLightDetailCardForm();
|
| | | form.AddForm(i_device, UserCenter.HdlRoomLogic.Current.CurrentRoom, 965, 1316);
|
| | | form.RowOrCardControl = this;
|
| | | form.AddForm(i_device, this.nowSelectRoom, 965, 1316);
|
| | | form.FormCloseEvent += this.CardDetailInfoBackEvent;
|
| | | };
|
| | | }
|
| | |
| | | /// </summary>
|
| | | public override void SendStatuComand()
|
| | | {
|
| | | if (Common.Config.Instance.Home.IsVirtually == true)
|
| | | {
|
| | | //如果住宅为虚拟住宅,则此功能无效
|
| | | return;
|
| | | }
|
| | | //检测能否发送获取状态命令
|
| | | if (this.CheckCanSendStatuComand() == true)
|
| | | {
|