ACAT.Extensions.Default.FunctionalAgents.LaunchAppAgent.LaunchAppScanner.refreshAppList C# (CSharp) Method

refreshAppList() private method

Refreshes the window list with a list of apps
private refreshAppList ( ) : void
return void
        private void refreshAppList()
        {
            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);
            }

            _entriesPerPage = count;
            _numPages = _appsList.Count() / _entriesPerPage;

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

            updateButtonBar();

            updateStatusBar();

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

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

            for (int jj = _pageStartIndex; jj < _appsList.Count && ii < count; ii++, jj++)
            {
                var tabStopScannerButton = list[ii] as TabStopScannerButton;

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

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

                var title = _appsList[jj].Name;

                var str = getMeasuredString(graphics, tabStopScannerButton.UIControl.Font, ClientSize.Width - 30, title);

                list[ii].SetText(str);
            }

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