ACAT.Extensions.Default.FunctionalAgents.PhraseSpeakAgent.PhraseSpeakScanner.refreshPhrasesList C# (CSharp) Method

refreshPhrasesList() private method

Refreshes the list of abbreviations and displays the current pageful of abbreviations in the UI.
private refreshPhrasesList ( ) : void
return void
        private void refreshPhrasesList()
        {
            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 = _abbreviationsList.Count() / _entriesPerPage;

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

            updateButtonBar();

            updateStatusBar();

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

            _abbreviationsList = sort(_abbreviationsList, _sortOrder);

            int ii = 0;

            for (int jj = _pageStartIndex; jj < _abbreviationsList.Count && ii < count; ii++, jj++)
            {
                (list[ii] as TabStopScannerButton).SetTabStops(0.0f, new float[] { 200 });

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

                var replaceWith = System.Text.RegularExpressions.Regex.Replace(_abbreviationsList[jj].Expansion, "\n", " ");

                list[ii].SetText(replaceWith);
            }
        }