Example #1
0
        public void RefreshFacts(string search = "")
        {
            var factsList    = activeSaveFile.GetKnownFacts();
            var listViewRows = new List <ListViewItem>();

            foreach (FactsTable.FactEntry fact in factsList)
            {
                if (search != "")
                {
                    if (!fact.FactName.ToLower().Contains(search.ToLower()))
                    {
                        continue;
                    }
                }

                var newItem = new ListViewItem(new string[] { fact.Value.ToString(), fact.FactName });
                newItem.Tag = fact;

                listViewRows.Add(newItem);
            }

            factsListView.BeginUpdate();
            factsListView.ListViewItemSorter = null;

            factsListView.Items.Clear();
            factsListView.Items.AddRange(listViewRows.ToArray());

            factsListView.ListViewItemSorter = factsColumnSorter;
            factsListView.Sort();
            factsListView.EndUpdate();
        }