Example #1
0
        public override void PostRender(float timePassed, int iLayer)
        {
            if (!_supportGUIVolume)
            {
                return;
            }

            if (VolumeHandler.Instance != null && !VolumeHandler.Instance.IsEnabledVolumeOSD)
            {
                return;
            }

            if (iLayer != 3)
            {
                GUIGraphicsContext.VolumeOverlay = false;
                return;
            }
            if (_volumeBar == null || _imgMute == null || _imgBG == null)
            {
                GUIGraphicsContext.VolumeOverlay = false;
                return;
            }
            TimeSpan ts = DateTime.Now - GUIGraphicsContext.VolumeOverlayTimeOut;

            //if ((ts.TotalSeconds > m_iAutoHideTimeOut)) // SE - TODO: setting
            if ((ts.TotalSeconds > 5) && !_imgMute.Visible)
            {
                GUIGraphicsContext.VolumeOverlay = false;
                return;
            }

            if (base.IsAnimating(AnimationType.WindowClose))
            {
                Render(timePassed);
                return;
            }

            foreach (CPosition pos in _listPositions)
            {
                pos.control.SetPosition(pos.XPos + +GUIGraphicsContext.VolumeOverlayOffsetX, pos.YPos + GUIGraphicsContext.VolumeOverlayOffsetY);
            }

            if (VolumeHandler.Instance != null && VolumeHandler.Instance.IsMuted)
            {
                _volumeBar.Maximum = VolumeHandler.Instance.StepMax;
                _volumeBar.Current = 0;
                if (!_imgBG.IsEffectAnimating(AnimationType.Hidden))
                {
                    _imgBG.Visible = false;
                }
                _imgMute.Visible  = true;
                _volumeBar.Image1 = 1;
            }
            else
            {
                if (VolumeHandler.Instance != null)
                {
                    _volumeBar.Maximum = VolumeHandler.Instance.StepMax;
                    _volumeBar.Current = VolumeHandler.Instance.Step;
                }
                if (!_imgMute.IsEffectAnimating(AnimationType.Hidden))
                {
                    _imgMute.Visible = false;
                }
                _imgBG.Visible    = true;
                _volumeBar.Image1 = 2;
                _volumeBar.Image2 = 1;
            }

            Render(timePassed);
        }