ACAT.Extensions.Default.FunctionalAgents.SwitchWindowsAgent.SwitchWindowsScanner.refreshWindowList C# (CSharp) Метод

refreshWindowList() приватный метод

Refresh the list of windows in the UI
private refreshWindowList ( ) : void
Результат void
        private void refreshWindowList()
        {
            var list = new List<Widget>();
            _scannerCommon.GetRootWidget().Finder.FindChild(typeof(TabStopScannerButton), list);

            int count = list.Count();
            if (count == 0)
            {
                return;
            }

            foreach (var button in list)
            {
                button.UserData = null;
                button.SetText(String.Empty);
            }

            // calculate how many pages, number of entries per page
            _entriesPerPage = count;
            _numPages = _windowsList.Count() / _entriesPerPage;

            if ((_windowsList.Count() % _entriesPerPage) != 0)
            {
                _numPages++;
            }

            updateButtonBar();

            updateStatusBar();

            if (!_windowsList.Any())
            {
                (list[0] as TabStopScannerButton).SetTabStops(0.0f, new float[] { 100 });
                list[0].SetText(Resources.NOACTIVEWINDOWS);
                return;
            }

            int ii = 0;
            var image = new Bitmap(1, 1);
            var graphics = Graphics.FromImage(image);

            // fill titles of windows in the list
            for (int jj = _pageStartIndex; jj < _windowsList.Count && ii < count; ii++, jj++)
            {
                var tabStopScannerButton = list[ii] as TabStopScannerButton;

                tabStopScannerButton.SetTabStops(0.0f, new float[] { 0 });

                list[ii].UserData = _windowsList[jj];

                var str = getMeasuredString(graphics,
                                            tabStopScannerButton.UIControl.Font,
                                            ClientSize.Width - 30,
                                            _windowsList[jj].Title);

                list[ii].SetText(str);
            }

            image.Dispose();
            graphics.Dispose();
        }