xm
2020-07-21 9a4b76398009cf76c508d61f7e48fb6f5cb7ac2d
ZigbeeApp/Shared/Phone/MainPage/Controls/DeviceCard/DeviceColorLightCardControl.cs
@@ -1,4 +1,5 @@
using System;
using Shared.Phone.UserCenter;
using System;
using System.Collections.Generic;
using System.Text;
using ZigBee.Device;
@@ -16,9 +17,9 @@
        /// 初始化控件
        /// </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);
@@ -27,9 +28,17 @@
            var btnSwitch = this.AddSwitchControl();
            btnSwitch.ButtonClickEvent += (sender, e) =>
            {
                //如果住宅为虚拟住宅
                if (Common.Config.Instance.Home.IsVirtually == true)
                {
                    //直接变更缓存
                    ((LightBase)i_device).OnOffStatus = btnSwitch.IsSelected == true ? 0 : 1;
                    this.RefreshControlInfo(this.device);
                    return;
                }
                bool setStatu = !btnSwitch.IsSelected;
                //变更卡片状态
                this.SetCardStatu(setStatu);
                this.SetCardOpenStatu(setStatu);
                //检测是否获取网关反馈的结果,如果网关没有回复,则会弹出消息
                this.StartCheckResponeResult(!setStatu);
@@ -62,12 +71,11 @@
            {
                Common.CommonPage.Instance.IsDrawerLockMode = true;
                var dimmableLightControl = new Phone.Device.Light.DimmableLightControl();
                UserView.HomePage.Instance.AddChidren(dimmableLightControl);
                UserView.HomePage.Instance.PageIndex += 1;
                dimmableLightControl.IsDrawerLockMode = true;
                dimmableLightControl.Show(i_device, UserCenter.HdlRoomLogic.Current.CurrentRoom);
                dimmableLightControl.action += this.CardDetailInfoBackEvent;
                //彩灯,调光器类型的深度卡片界面
                var form = new ControlForm.DeviceColorLightDetailCardForm();
                form.RowOrCardControl = this;
                form.AddForm(i_device, this.nowSelectRoom, 965, 1316);
                form.FormCloseEvent += this.CardDetailInfoBackEvent;
            };
        }
@@ -92,10 +100,18 @@
        /// <summary>
        /// 发送获取状态命令
        /// </summary>
        /// <param name="i_device"></param>
        public override void SendStatuComand(CommonDevice i_device)
        public override void SendStatuComand()
        {
            Device.DeviceLogic.ReadDeviceAttributeLogic.Instance.SendDimmableLightStatuComand(i_device);
            if (Common.Config.Instance.Home.IsVirtually == true)
            {
                //如果住宅为虚拟住宅,则此功能无效
                return;
            }
            //检测能否发送获取状态命令
            if (this.CheckCanSendStatuComand() == true)
            {
               HdlDeviceAttributeLogic.Current.SendDimmableLightStatuComand(this.device);
            }
        }
        #endregion