private void UpdateProcesses()
        {
            if (!this.AutoHandleFavorites)
            {
                MainWindow frm = MainWindow.ext();

                if (frm != null)
                {
                    if ((frm.WindowState == FormWindowState.Minimized) || (!frm.Visible))
                    {
                        return;
                    }
                }
            }

            lock (updateLock)
            {
                for (int i = 0; i < _processDetails.Count;)
                {
                    var pd = _processDetails[i];

                    bool should_be_pruned = pd.ProcessHasExited;

                    if (!should_be_pruned)
                    {
                        string current_title = "";

                        if (!pd.NoAccess)
                        {
                            Tools.StartMethodMultithreadedAndWait(() => { current_title = Native.GetWindowTitle(pd.WindowHandle); }, (Utilities.AppEnvironment.SettingValue("SlowWindowDetection", false)) ? 10 : 2);
                            should_be_pruned = should_be_pruned || (pd.WindowTitle != current_title);
                        }
                    }

                    if (should_be_pruned)
                    {
                        if (pd.MadeBorderless)
                        {
                            HandlePrunedProcess(pd);
                        }
                        _processDetails.RemoveAt(i);
                    }
                    else
                    {
                        i++;
                    }
                }

                windows.QueryProcessesWithWindows((pd) =>
                {
                    if (_hiddenProcesses.IsHidden(pd.Proc.ProcessName))
                    {
                        return;
                    }
                    if (!_processDetails.Select(p => p.Proc.Id).Contains(pd.Proc.Id))
                    {
                        _processDetails.Add(pd);
                    }
                }, _processDetails.WindowPtrSet);

                window.lblUpdateStatus.Text = "Last updated " + DateTime.Now.ToString();
            }
        }
        private void UpdateProcesses()
        {
            // Note: additional try/catch blocks were added here to prevent stalls when Windows is put into
            //       suspend or hibernation.

            try
            {
                if (!AutoHandleFavorites)
                {
                    MainWindow frm = MainWindow.ext();

                    if (frm != null)
                    {
                        if ((frm.WindowState == FormWindowState.Minimized) || (!frm.Visible))
                        {
                            return;
                        }
                    }
                }
            }
            catch { } // swallow any exceptions in attempting to check window minimize/visibility state

            lock (updateLock)
            {
                // check existing processes for changes (auto-prune)
                for (int i = 0; i < _processDetails.Count;)
                {
                    try
                    {
                        var pd = _processDetails[i];

                        var shouldBePruned = pd.ProcessHasExited;

                        if (!shouldBePruned)
                        {
                            var currentTitle = "";

                            if (!pd.NoAccess)
                            {
                                Tools.StartTaskAndWait(() => { currentTitle = Native.GetWindowTitle(pd.WindowHandle); }, (AppEnvironment.SettingValue("SlowWindowDetection", false)) ? 10 : 2);
                                shouldBePruned = shouldBePruned || (pd.WindowTitle != currentTitle);
                            }
                        }

                        if (shouldBePruned)
                        {
                            if (pd.MadeBorderless)
                            {
                                HandlePrunedProcess(pd);
                            }
                            _processDetails.RemoveAt(i);
                        }
                        else
                        {
                            i++;
                        }
                    }
                    catch
                    {
                        // swallow any exceptions and move to the next item in the array
                        i++;
                    }
                }

                // add new process windows
                try
                {
                    windows.QueryProcessesWithWindows((pd) =>
                    {
                        if (_hiddenProcesses.IsHidden(pd.Proc.ProcessName))
                        {
                            return;
                        }
                        if (!_processDetails.Select(p => p.Proc.Id).Contains(pd.Proc.Id) ||
                            !_processDetails.Select(p => p.WindowTitle).Contains(pd.WindowTitle))
                        {
                            _processDetails.Add(pd);
                        }
                    }, _processDetails.WindowPtrSet);
                }
                catch { } // swallow any exceptions in attempting to add new windows

                // update window
                window.lblUpdateStatus.Text = "Right-click for more options.  Last updated " + DateTime.Now.ToString();
            }
        }