陈嘉乐
2020-04-27 18b93d511dc764b469d7c4a7e755f7274f89cdb4
ZigbeeApp/Shared/Phone/MainPage/Controls/DeviceCard/Base/DeviceCardCommon.cs
@@ -68,9 +68,9 @@
        public DeviceCardCommon()
        {
            //图片真实宽度+图片自身左右空白
            this.Width = Application.GetMinRealAverage(458 + 14 * 2);
            this.Width = HdlControlLogic.Current.GetPictrueRealSize(458 + 14 * 2);
            //图片高度+阴影
            this.Height = Application.GetMinRealAverage(305 + 43);
            this.Height = HdlControlLogic.Current.GetPictrueRealSize(305 + 43);
            //取消点击特效
            this.UseClickStatu = false;
        }
@@ -91,8 +91,8 @@
            //设备名称控件
            this.btnDeviceName = new NormalViewControl(320, 63, true);
            btnDeviceName.X = Application.GetMinRealAverage(40);
            btnDeviceName.Y = Application.GetMinRealAverage(17);
            btnDeviceName.X = HdlControlLogic.Current.GetPictrueRealSize(40);
            btnDeviceName.Y = HdlControlLogic.Current.GetPictrueRealSize(17);
            btnDeviceName.TextSize = 16;
            btnDeviceName.TextColor = UserCenterColor.Current.TextGrayColor1;
            btnDeviceName.SelectedTextColor = UserCenterColor.Current.White;
@@ -101,8 +101,8 @@
            //收集控件
            this.btnCollect = new IconViewControl(107);
            btnCollect.X = Application.GetMinRealAverage(350);
            btnCollect.Y = Application.GetMinRealAverage(12);
            btnCollect.X = HdlControlLogic.Current.GetPictrueRealSize(350);
            btnCollect.Y = HdlControlLogic.Current.GetPictrueRealSize(12);
            btnCollect.UnSelectedImagePath = "Item/Collection1.png";
            btnCollect.SelectedImagePath = "Item/CollectionSelected1.png";
            this.AddChidren(btnCollect, ChidrenBindMode.NotBind);
@@ -130,11 +130,11 @@
            //设备的背景圆圈图
            this.fraDeviceRound = new FrameLayout();
            fraDeviceRound.Width = Application.GetMinRealAverage(124);
            fraDeviceRound.Height = Application.GetMinRealAverage(124);
            fraDeviceRound.Radius = (uint)Application.GetMinRealAverage(124) / 2;
            fraDeviceRound.X = Application.GetMinRealAverage(44);
            fraDeviceRound.Y = Application.GetMinRealAverage(101);
            fraDeviceRound.Width = HdlControlLogic.Current.GetPictrueRealSize(124);
            fraDeviceRound.Height = HdlControlLogic.Current.GetPictrueRealSize(124);
            fraDeviceRound.Radius = (uint)HdlControlLogic.Current.GetPictrueRealSize(124) / 2;
            fraDeviceRound.X = HdlControlLogic.Current.GetPictrueRealSize(44);
            fraDeviceRound.Y = HdlControlLogic.Current.GetPictrueRealSize(101);
            fraDeviceRound.BackgroundColor = Common.ZigbeeColor.Current.GXCForFunctionUnSelectedBackgroundColor;
            this.AddChidren(fraDeviceRound, ChidrenBindMode.BindEventOnly);
@@ -145,9 +145,9 @@
            this.ChangedChidrenBindMode(fraDeviceRound, ChidrenBindMode.BindEventOnly);
            //状态文本控件
            this.btnStatu = new NormalViewControl(Application.GetMinRealAverage(280), Application.GetMinRealAverage(63), false);
            btnStatu.X = Application.GetMinRealAverage(46);
            btnStatu.Y = Application.GetMinRealAverage(236);
            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;
            btnStatu.SelectedTextColor = Common.ZigbeeColor.Current.GXCTextSelectedColor;
            btnStatu.IsBold = true;
@@ -155,8 +155,8 @@
            //开关控件(不加入父控件中)
            this.btnSwitch = new PicViewControl(109, 104);
            btnSwitch.X = Application.GetMinRealAverage(325);
            btnSwitch.Y = Application.GetMinRealAverage(202);
            btnSwitch.X = HdlControlLogic.Current.GetPictrueRealSize(325);
            btnSwitch.Y = HdlControlLogic.Current.GetPictrueRealSize(202);
            btnSwitch.UnSelectedImagePath = "Item/Switch1.png";
            btnSwitch.SelectedImagePath = "Item/SwitchSelected1.png";
@@ -195,8 +195,16 @@
            }
            //设备图标也刷新
            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)
            {
                //如果这个卡片有开关功能,并且网关还没有回复之前,默认是关闭状态
                //等待网关回复后会重新刷新,不然一直是关闭状态
                isOpen = false;
            }
            this.SetCardOpenStatu(isOpen);
        }
@@ -303,19 +311,24 @@
        /// <param name="room">房间</param>
        public void CardDetailInfoBackEvent(CommonDevice device, Common.Room room)
        {
            //如果是主页取消搜藏的话,回调卡片被删除的函数
            if (HdlRoomLogic.Current.CurrentRoom.IsLove
            && HdlRoomLogic.Current.IsCollectInRoom(device) == false)
            if (HdlRoomLogic.Current.CurrentRoom.IsLove == true)
            {
                this.CardNeedRemoveEvent?.Invoke();
                return;
                //如果是主页取消搜藏的话,回调卡片被删除的函数
                if (HdlRoomLogic.Current.IsCollectInRoom(device) == false)
                {
                    this.CardNeedRemoveEvent?.Invoke();
                    return;
                }
            }
            //如果这个设备改变了房间的话,回调卡片被删除的函数
            var nowRoom = HdlRoomLogic.Current.GetRoomByDevice(device);
            if (nowRoom == null || nowRoom.Id != HdlRoomLogic.Current.CurrentRoom.Id)
            else
            {
                this.CardNeedRemoveEvent?.Invoke();
                return;
                //如果这个设备改变了房间的话,回调卡片被删除的函数
                var nowRoom = HdlRoomLogic.Current.GetRoomByDevice(device);
                if (nowRoom == null || nowRoom.Id != HdlRoomLogic.Current.CurrentRoom.Id)
                {
                    this.CardNeedRemoveEvent?.Invoke();
                    return;
                }
            }
            //如果它还在这个房间的话,刷新卡片信息
            this.RefreshControlInfo(device);
@@ -332,6 +345,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; }