黄学彪
2020-05-19 e747e6d8524e3146bb48dc304a713f309966b1c6
ZigbeeApp/Shared/Phone/MainPage/Controls/DeviceCard/Base/DeviceCardCommon.cs
@@ -9,7 +9,7 @@
    /// <summary>
    /// 主页的设备卡片控件底层共通(宽度:458 + 14 * 2 高度:305 + 43)
    /// </summary>
    public class DeviceCardCommon : FrameLayoutControl
    public class DeviceCardCommon : FrameLayoutStatuControl
    {
        #region ■ 变量声明___________________________
@@ -57,6 +57,10 @@
        /// 判断是否有开关功能
        /// </summary>
        private bool isHadOpenSwitch = true;
        /// <summary>
        /// 当前选择的房间
        /// </summary>
        public Common.Room nowSelectRoom = null;
        #endregion
@@ -79,9 +83,11 @@
        /// 初始化控件
        /// </summary>
        /// <param name="i_device">指定设备</param>
        public virtual void InitControl(CommonDevice i_device)
        /// <param name="i_nowSelectRoom">当前选择的房间(有点用处)</param>
        public virtual void InitControl(CommonDevice i_device, Common.Room i_nowSelectRoom)
        {
            this.device = i_device;
            this.nowSelectRoom = i_nowSelectRoom;
            //背景图片
            this.btnBackGroud = new PicViewControl(this.Width, this.Height, false);
            btnBackGroud.UnSelectedImagePath = "Item/FunctionCardView.png";
@@ -115,7 +121,7 @@
                {
                    //取消收藏
                    HdlRoomLogic.Current.DeleteLoveDevice(i_device);
                    if (HdlRoomLogic.Current.CurrentRoom.IsLove == true)
                    if (this.nowSelectRoom.IsLove == true)
                    {
                        //如果当前房间是我的喜爱的话,回调卡片被删除的事件
                        this.CardNeedRemoveEvent?.Invoke();
@@ -145,7 +151,7 @@
            this.ChangedChidrenBindMode(fraDeviceRound, ChidrenBindMode.BindEventOnly);
            //状态文本控件
            this.btnStatu = new NormalViewControl(HdlControlLogic.Current.GetPictrueRealSize(280), HdlControlLogic.Current.GetPictrueRealSize(63), false);
            this.btnStatu = new NormalViewControl(HdlControlLogic.Current.GetPictrueRealSize(300), HdlControlLogic.Current.GetPictrueRealSize(63), false);
            btnStatu.X = HdlControlLogic.Current.GetPictrueRealSize(46);
            btnStatu.Y = HdlControlLogic.Current.GetPictrueRealSize(236);
            btnStatu.TextColor = UserCenterColor.Current.TextColor1;
@@ -195,6 +201,8 @@
            }
            //设备图标也刷新
            Common.LocalDevice.Current.SetDeviceIconToControl2(btnDeviceIcon, i_device);
            //名字刷新
            this.btnDeviceName.Text = Common.LocalDevice.Current.GetDeviceEpointName(i_device);
            //检测设备是否是打开状态
            bool isOpen = this.CheckIsOpenStatu(i_device);
            if (this.isHadOpenSwitch == true && i_device.HadReadDeviceStatu == false)
@@ -294,7 +302,7 @@
            //如果这个函数被重写的话,则代表这个设备有开关功能
            this.isHadOpenSwitch = false;
            //默认用在线状态来判断
            return i_device.IsOnline == 1;
            return Common.LocalDevice.Current.CheckDeviceIsOnline(i_device);
        }
@@ -306,10 +314,9 @@
        /// 深度卡片信息的返回事件(底层专用)
        /// </summary>
        /// <param name="device">设备</param>
        /// <param name="room">房间</param>
        public void CardDetailInfoBackEvent(CommonDevice device, Common.Room room)
        public void CardDetailInfoBackEvent(CommonDevice device)
        {
            if (HdlRoomLogic.Current.CurrentRoom.IsLove == true)
            if (this.nowSelectRoom.IsLove == true)
            {
                //如果是主页取消搜藏的话,回调卡片被删除的函数
                if (HdlRoomLogic.Current.IsCollectInRoom(device) == false)
@@ -322,7 +329,7 @@
            {
                //如果这个设备改变了房间的话,回调卡片被删除的函数
                var nowRoom = HdlRoomLogic.Current.GetRoomByDevice(device);
                if (nowRoom == null || nowRoom.Id != HdlRoomLogic.Current.CurrentRoom.Id)
                if (nowRoom == null || nowRoom.Id != this.nowSelectRoom.Id)
                {
                    this.CardNeedRemoveEvent?.Invoke();
                    return;
@@ -343,6 +350,11 @@
        /// <param name="oldOpenStatu">设备目前的开关状态</param>
        public void StartCheckResponeResult(bool oldOpenStatu)
        {
            if (Common.Config.Instance.Home.IsVirtually == true)
            {
                //如果住宅为虚拟住宅,则此功能无效
                return;
            }
            this.ResponeResult = 0;
            //开关按钮不能再点击
            if (btnSwitch != null) { this.btnSwitch.CanClick = false; }