Beispiel #1
0
        private void AddNewRule(SelectionRule rule)
        {
            System.Diagnostics.Debug.Assert(listView1.Items.Count == AppConfig.SelectionRules.Count);

            // Store the new rule
            AppConfig.UnsavedChanges = true;
            AppConfig.SelectionRules.Add(rule);

            // Display the new rule
            RuleListViewItem lvi = new RuleListViewItem(rule);
            listView1.Items.Add(lvi);

            System.Diagnostics.Debug.Assert(listView1.Items.Count == AppConfig.SelectionRules.Count);
        }
Beispiel #2
0
        public void DisplayRules(IEnumerable<SelectionRule> rules, BrowserInfo[] browsers)
        {
            listView1.SmallImageList = new ImageList();
            listView1.SmallImageList.ColorDepth = ColorDepth.Depth32Bit;
            listView1.SmallImageList.ImageSize = new System.Drawing.Size(16, 16);

            listView1.Items.Clear();

            Dictionary<string, int> browserNameToIndex = new Dictionary<string, int>();

            int n = 0;
            foreach (BrowserInfo browser in browsers)
            {
                browserNameToIndex.Add(browser.Name, n);
                listView1.SmallImageList.Images.Add(browser.Name, browser.Icon);
                n++;
            }

            foreach (SelectionRule rule in rules)
            {
                RuleListViewItem lvi = new RuleListViewItem(rule);
                listView1.Items.Add(lvi);
            }
        }