Esempio n. 1
0
        private static void Timer_Tick(object sender, EventArgs e)
        {
            if (UserSettings.AutoModeType != AutoModeType.Auto)
            {
                return;
            }

            // get taskbar every 1.25 second.
            if (_timerCount % 5 == 0)
            {
                // Make sure the taskbar has been automatically hidden, otherwise it will not work
                Fun.SetAutoHide();

                _taskbar = TaskbarHelper.InitTaskbar();

                // Some users will kill the explorer.exe under certain situation.
                // In this case, the taskbar cannot be found, just return and wait for the user to reopen the file explorer.
                if (_taskbar.Handle == IntPtr.Zero)
                {
                    Hooker.ReleaseHook();
                    return;
                }

                Hooker.SetHook(_taskbar.Handle);
            }

            switch (_taskbar.CheckIfMouseOver(NonMouseOverShowHandleSet))
            {
            case TaskbarBehavior.DoNothing:
                break;

            case TaskbarBehavior.Pending:
                if (UserSettings.ReduceTaskbarDisplay)
                {
                    CheckCurrentWindowReduceShowBar();
                }
                else
                {
                    CheckCurrentWindow();
                }

                break;

            case TaskbarBehavior.Show:
                    #if DEBUG
                Debug.WriteLine("Show the tasbkar because of Mouse Over.");
                    #endif

                _taskbar.ShowTaskar();
                break;
            }

            ++_timerCount;

            // clear cache and reset stable every 15 min.
            if (_timerCount <= 7200)
            {
                return;
            }

            _timerCount = 0;

            DesktopHandleSet.Clear();
            NonMouseOverShowHandleSet.Clear();
            NonDesktopShowHandleSet.Clear();
            NonForegroundShowHandleSet.Clear();
            Hooker.ResetHook();
        }