示例#1
0
        // OK clicked
        private void apply_Click(object sender, EventArgs e)
        {
            //mxd. Store current filter name
            string currentfiltername = string.Empty;

            if (!(General.Map.ThingsFilter is NullThingsFilter))
            {
                currentfiltername = General.Map.ThingsFilter.Name;
            }

            // Clear all filters and add the new ones
            General.Map.ConfigSettings.ThingsFilters.Clear();
            ThingsFilter currentfilter = new NullThingsFilter();             //mxd

            foreach (ListViewItem item in listfilters.Items)
            {
                ThingsFilter f = item.Tag as ThingsFilter;                                   //mxd
                if (!string.IsNullOrEmpty(currentfiltername) && f.Name == currentfiltername) //mxd
                {
                    currentfilter = f;
                }
                General.Map.ConfigSettings.ThingsFilters.Add(f);
            }


            // Update stuff
            General.Map.ChangeThingFilter(currentfilter);
            General.MainWindow.UpdateThingsFilters();
            General.Map.ConfigSettings.Changed = true;

            // Close
            this.DialogResult = DialogResult.OK;
            this.Close();
        }
示例#2
0
        // This changes thing filter
        public void ChangeThingFilter(ThingsFilter newfilter)
        {
            // We have a special filter for null
            if (newfilter == null)
            {
                newfilter = new NullThingsFilter();
            }

            // Deactivate old filter
            if (thingsfilter != null)
            {
                thingsfilter.Deactivate();
            }

            // Change
            thingsfilter = newfilter;

            // Activate filter
            thingsfilter.Activate();

            // Update interface
            General.MainWindow.ReflectThingsFilter();

            // Redraw
            General.MainWindow.RedrawDisplay();
        }