private void ImpacterListView_ColumnClick(object sender, ColumnClickEventArgs e)
        {
            if (e.Column == LvwColumnSorter.ColumnToSort)
            {
                if (LvwColumnSorter.OrderOfSort == SortOrder.Ascending)
                {
                    LvwColumnSorter.OrderOfSort = SortOrder.Descending;
                }
                else
                {
                    LvwColumnSorter.OrderOfSort = SortOrder.Ascending;
                }
            }
            else
            {
                LvwColumnSorter.ColumnToSort = e.Column;
                LvwColumnSorter.OrderOfSort  = SortOrder.Ascending;
            }

            //
            // treat age and diameter as numeric values
            //

            LvwColumnSorter.IsExtendedNumeric = (LvwColumnSorter.ColumnToSort == 4 || LvwColumnSorter.ColumnToSort == 5) ? true : false;

            ImpacterListView.Sort();
        }
        private void AddItemsToListView(ListView listView)
        {
            if (listView != null)
            {
                listView.BeginUpdate();
            }

            ImpacterListView.Clear();
            AddColumnsToListView(listView);

            List <ListViewItem> items = new List <ListViewItem> ();

            if (ImpactCraters.CraterArray != null)
            {
                foreach (ImpactCrater crater in ImpactCraters.CraterArray)
                {
                    if (Queries.CurrentQueries != null)
                    {
                        if (!Queries.CurrentQueries.MatchesQuery(crater))
                        {
                            continue;
                        }
                    }

                    ListViewItem item = new ListViewItem(crater.Name, 0);

                    item.SubItems.Add(Helper.GetText(crater.Location));
                    item.SubItems.Add(Helper.GetText(crater.Latitude));
                    item.SubItems.Add(Helper.GetText(crater.Longitude));
                    item.SubItems.Add(Helper.GetText(crater.Diameter));
                    item.SubItems.Add(Helper.GetText(crater.Age));
                    item.SubItems.Add(Helper.GetText(Period.Get(crater)));
                    item.SubItems.Add(Helper.GetText(crater.Exposed));
                    item.SubItems.Add(Helper.GetText(crater.Drilled));
                    item.SubItems.Add(Helper.GetText(crater.TargetRock));
                    item.SubItems.Add(Helper.GetText(crater.BolideType));
                    item.Tag = crater;

                    items.Add(item);
                }
            }

            if (listView != null)
            {
                listView.Items.AddRange(items.ToArray());
                listView.EndUpdate();
            }
        }
        public ImpactCratersDialog()
        {
            InitializeComponent();

            ReadSettings();

            LvwColumnSorter = new ListViewColumnSorter();

            CreateImpacterListView();
            ImpacterListView.ListViewItemSorter = LvwColumnSorter;
            LvwColumnSorter.ColumnToSort        = 1;
            LvwColumnSorter.OrderOfSort         = SortOrder.Ascending;
            ImpacterListView.Sort();

            ResizeBegin += new EventHandler(ImpacterResizeBegin);
            ResizeEnd   += new EventHandler(ImpacterResizeEnd);
            SizeChanged += new EventHandler(ImpacterResize);
        }