LayoutFarm.Demo_SingleLineText_WithSuggestion.UpdateSuggestionList C# (CSharp) Метод

UpdateSuggestionList() приватный Метод

private UpdateSuggestionList ( ) : void
Результат void
        void UpdateSuggestionList()
        {
            //find suggestion words 
            this.currentLocalText = null;
            listView.ClearItems();
            if (textbox.CurrentTextSpan == null)
            {
                listView.Visible = false;
                return;
            }
            //-------------------------------------------------------------------------
            //simple parse ...
            //In this example  all country name start with Captial letter so ...
            string currentTextSpanText = textbox.CurrentTextSpan.Text.ToUpper();
            //analyze content
            char[] textBuffer = currentTextSpanText.ToCharArray();
            var results = new List<LayoutFarm.Composers.TextSplitBound>();
            results.AddRange(textbox.TextSplitter.ParseWordContent(textBuffer, 0, textBuffer.Length));
            //get last part of splited text
            int m = results.Count;
            if (m < 1)
            {
                return;
            }
            Composers.TextSplitBound lastSplitPart = results[m - 1];
            this.currentLocalText = GetString(textBuffer, lastSplitPart);
            //char firstChar = currentTextSpanText[0];
            char firstChar = currentLocalText[0];
            List<string> keywords;
            if (words.TryGetValue(firstChar, out keywords))
            {
                int j = keywords.Count;
                int listViewWidth = listView.Width;
                for (int i = 0; i < j; ++i)
                {
                    string choice = keywords[i].ToUpper();
                    if (choice.StartsWith(currentLocalText))
                    {
                        CustomWidgets.ListItem item = new CustomWidgets.ListItem(listViewWidth, 17);
                        item.BackColor = Color.LightGray;
                        item.Tag = item.Text = keywords[i];
                        listView.AddItem(item);
                    }
                }
            }
            if (listView.ItemCount > 0)
            {
                listView.Visible = true;
            }
            else
            {
                listView.Visible = false;
            }

            //-------------------------------------------------------------------------
        }