黄学彪
2020-07-06 f23ad1b3f9f6193f35f72104d690b21dc67d5c1f
ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/DeviceObjectControl.cs
@@ -160,27 +160,60 @@
                return;
            }
            this.sensorPushing = true;
            //设备
            uint oldTextColor1 = btnDeviceName.TextColor;
            btnDeviceName.TextColor = UserCenterColor.Current.TextOrangeColor;
            //设备房间
            uint oldTextColor2 = btnDeviceRoom.TextColor;
            btnDeviceRoom.TextColor = UserCenterColor.Current.TextOrangeColor;
            HdlThreadLogic.Current.RunThread(() =>
            {
                System.Threading.Thread.Sleep(5000);
                HdlThreadLogic.Current.RunMain(() =>
                //闪烁5秒,间隔400毫秒
                int count = 5000 / 400;
                bool isOpen = false;
                while (this.Parent != null && count >= 0)
                {
                    if (btnDeviceName.Parent != null)
                    //闪烁特效
                    HdlThreadLogic.Current.RunMain(() =>
                    {
                        //设备
                        btnDeviceName.TextColor = oldTextColor1;
                        //设备房间
                        btnDeviceRoom.TextColor = oldTextColor2;
                    }
                    this.sensorPushing = false;
                }, ShowErrorMode.NO);
            });
                        isOpen = !isOpen;
                        this.SwitchRowStatuAppeal(isOpen);
                    }, ShowErrorMode.NO);
                    System.Threading.Thread.Sleep(400);
                    count--;
                }
                if (this.Parent != null && isOpen == true)
                {
                    HdlThreadLogic.Current.RunMain(() =>
                    {
                        //结束时,默认为无特效
                        this.SwitchRowStatuAppeal(false);
                    }, ShowErrorMode.NO);
                }
                this.sensorPushing = false;
            }, ShowErrorMode.NO);
        }
        /// <summary>
        /// 切换行闪烁特效
        /// </summary>
        /// <param name="isOpen"></param>
        private void SwitchRowStatuAppeal(bool isOpen)
        {
            if (isOpen == true)
            {
                //图标
                btnIcon.IsSelected = true;
                //设备
                btnDeviceName.TextColor = UserCenterColor.Current.TextOrangeColor;
                //设备房间
                btnDeviceRoom.TextColor = UserCenterColor.Current.TextOrangeColor;
            }
            else
            {
                //图标
                btnIcon.IsSelected = false;
                //设备
                btnDeviceName.TextColor = UserCenterColor.Current.TextColor1;
                //设备房间
                btnDeviceRoom.TextColor = UserCenterColor.Current.TextGrayColor1;
            }
        }
        #endregion