黄学彪
2019-11-25 160785587667cc0d927f85e44c139ec9dde13a9e
ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/DeviceObjectControl.cs
@@ -24,6 +24,10 @@
        /// </summary>
        private bool m_isOnline = false;
        /// <summary>
        /// 传感器推送中
        /// </summary>
        private bool sensorPushing = false;
        /// <summary>
        /// 在线状态
        /// </summary>
        public bool isOnline
@@ -42,13 +46,13 @@
        /// </summary>
        public IconViewControl btnIcon = null;
        /// <summary>
        /// 设备类型控件
        /// </summary>
        private NormalViewControl btnDeviceObject = null;
        /// <summary>
        /// 设备备注控件
        /// </summary>
        private NormalViewControl btnDeviceName = null;
        /// <summary>
        /// 设备房间控件
        /// </summary>
        private NormalViewControl btnDeviceRoom = null;
        #endregion
@@ -74,32 +78,30 @@
            btnIcon = frameTable.AddLeftIcon(81);
            Common.LocalDevice.Current.SetDeviceBeloneIconToControl(btnIcon, listDevice);
            //设备类型
            string objText = Common.LocalDevice.Current.GetDeviceObjectText(listDevice);
            btnDeviceObject = frameTable.AddLeftCaption(objText, 800, 60, true);
            btnDeviceObject.TextSize = 15;
            //这个坐标有点特殊
            btnDeviceObject.Y = Application.GetRealHeight(12) + this.chidrenYaxis;
            btnDeviceObject.Text = Common.LocalDevice.Current.GetDeviceObjectText(listDevice);
            frameTable.AddChidren(btnDeviceObject, ChidrenBindMode.BindEventOnly);
            //设备
            string deviceName = Common.LocalDevice.Current.GetDeviceMacName(listDevice[0]);
            btnDeviceName = frameTable.AddLeftCaption(deviceName, 800, 49, true);
            btnDeviceName = frameTable.AddLeftCaption(deviceName, 800, 60, true);
            btnDeviceName.TextSize = 15;
            //这个坐标有点特殊
            btnDeviceName.Y = Application.GetRealHeight(72) + this.chidrenYaxis;
            btnDeviceName.TextSize = 12;
            btnDeviceName.TextColor = UserCenterColor.Current.TextGrayColor1;
            btnDeviceName.Text = Common.LocalDevice.Current.GetDeviceMacName(listDevice[0]);
            btnDeviceName.Y = Application.GetRealHeight(12) + this.chidrenYaxis;
            btnDeviceName.Text = Common.LocalDevice.Current.GetDeviceObjectText(listDevice);
            frameTable.AddChidren(btnDeviceName, ChidrenBindMode.BindEventOnly);
            //房间
            string roomName = Common.LocalDevice.Current.GeteRealDeviceRoomName(listDevice[0]);
            btnDeviceRoom = frameTable.AddLeftCaption(roomName, 800, 49, true);
            //这个坐标有点特殊
            btnDeviceRoom.Y = Application.GetRealHeight(72) + this.chidrenYaxis;
            btnDeviceRoom.TextSize = 12;
            btnDeviceRoom.TextColor = UserCenterColor.Current.TextGrayColor1;
            btnDeviceRoom.Text = Common.LocalDevice.Current.GetDeviceMacName(listDevice[0]);
            frameTable.AddChidren(btnDeviceRoom, ChidrenBindMode.BindEventOnly);
            //底线
            frameTable.AddBottomLine();
            //设置在线状态的特效
            this.isOnline = listDevice[0].IsOnline == 1;
            listDevice = null;
        }
        #endregion
@@ -114,11 +116,11 @@
        {
            if (isOnline == false)
            {
                btnDeviceObject.TextColor = UserCenterColor.Current.TextGrayColor1;
                btnDeviceName.TextColor = UserCenterColor.Current.TextGrayColor1;
            }
            else
            {
                btnDeviceObject.TextColor = UserCenterColor.Current.TextColor1;
                btnDeviceName.TextColor = UserCenterColor.Current.TextColor1;
            }
        }
@@ -137,15 +139,49 @@
            var listDevice = Common.LocalDevice.Current.GetDevicesByMac(this.deviceMac);
            //图标
            Common.LocalDevice.Current.SetDeviceBeloneIconToControl(btnIcon, listDevice);
            //设备类型
            btnDeviceObject.Text = Common.LocalDevice.Current.GetDeviceObjectText(listDevice);
            //设备
            btnDeviceName.Text = Common.LocalDevice.Current.GetDeviceMacName(listDevice[0]);
            //设备房间
            btnDeviceRoom.Text = Common.LocalDevice.Current.GeteRealDeviceRoomName(listDevice[0]);
            //设置在线状态的特效
            this.isOnline = listDevice[0].IsOnline == 1;
            listDevice = null;
        }
        /// <summary>
        /// 显示传感器上报的特效
        /// </summary>
        public void StartSensorPushAppeal()
        {
            if (this.sensorPushing == true)
            {
                //传感器正在特效中
                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(() =>
                {
                    if (btnDeviceName.Parent != null)
                    {
                        //设备
                        btnDeviceName.TextColor = oldTextColor1;
                        //设备房间
                        btnDeviceRoom.TextColor = oldTextColor2;
                    }
                    this.sensorPushing = false;
                }, ShowErrorMode.NO);
            });
        }
        #endregion
    }
}