Пример #1
0
 private void countdescendingToolStripMenuItem_Click(object sender, EventArgs e)
 {
     CategorySort sort = new CategorySort { Column = 1, Order = SortOrder.Descending };
     SortCategories(sort);
 }
Пример #2
0
        private void SortCategories(CategorySort sort)
        {
            // save new sort as current sort
            currentSort = sort;

            // save currently selected games
            SortedSet<int> selectedIds = GetSelectedGameIds();

            lstCategories.BeginUpdate();

            // save and remove Specials from list.
            List<ListViewItem> specials = RemoveSpecials();

            // Create a comparer.
            lstCategories.ListViewItemSorter =
                new ListViewComparer(sort.Column, sort.Order);

            // Sort.
            lstCategories.Sort();

            // remove sort so that Specials will not get sorted as they are added.
            lstCategories.ListViewItemSorter = null;

            // add Specials.
            InsertSpecials(specials);

            // restore games selection
            SelectGameSet(selectedIds);

            lstCategories.EndUpdate();

        }