Example #1
0
        private void Update()
        {
            if (_settings.Disabled || _view.AnimationRunning)
            {
                return;
            }

            if ((App.IsMuted || _settings.IsMuted()) && !_settings.IgnoreMute)
            {
                Hide(checkHideStatus: false, checkIdleStatus: false);
                return;
            }

            if (!_settings.FullscreenActivation &&
                FullScreenHelper.DoesMonitorHaveFullscreenApp(_view.ViewModel.GetActualScreenBounds(), _view.ThisApp))
            {
                _showTimer.Stop();
                _hideTimer.Stop();
                Hide(false, false, false);
                return;
            }

            if (QueueIntro != null && !App.IsWorkstationLocked)
            {
                _view.ShowIntro(QueueIntro);
                return;
            }

            if (_settings.OpenMode == OpenMode.AlwaysOpen || KeepOpenForIntro)
            {
                Show();
                return;
            }

            if (_settings.DetectIdle && KeepOpenUntilIdle)
            {
                if (!_view.IsIdle)
                {
                    Show();
                }
                else
                {
                    Hide();
                }
                return;
            }

            if (_settings.OpenMode == OpenMode.Hidden)
            {
                Hide();
                return;
            }

            UpdateVisibilityStatus();
        }
        public void ShowIntro(IntroData introData = null)
        {
            _mouseChecker.QueueIntro = null;
            if (introData == null)
            {
                introData = new IntroData();
            }
            if (App.IsWorkstationLocked || FullScreenHelper.DoesMonitorHaveFullscreenApp(ViewModel.GetScreenBounds()))
            {
                _mouseChecker.QueueIntro = introData;
                return;
            }
            _lastIntroData = introData;
            if (_introTimer == null)
            {
                _introTimer       = new DispatcherTimer();
                _introTimer.Tick += delegate
                {
                    _introTimer.Stop();
                    if (_lastIntroData.HideOnFinish)
                    {
                        HideIntro();
                    }
                    if (_lastIntroData.ExecuteFinishAction)
                    {
                        ViewModel.OnIntroEnd();
                    }
                };
            }

            _introTimer.Stop();
            _introTimer.Interval =
                TimeSpan.FromMilliseconds(introData.Duration == -1 ? Settings.IntroDuration : introData.Duration);
            if (_mouseChecker.KeepOpenForIntro && introData.Reversable)
            {
                HideIntro(false);
            }
            else if (introData.Duration != 0)
            {
                _mouseChecker.KeepOpenForIntro = true;
                _introTimer.Start();
                ViewModel.OnIntro();
                _mouseChecker.Show(activate: introData.Activate);
            }
        }