Example #1
0
        public HitsDB()
        {
            vm          = SB.HitsDB;
            DataContext = vm;

            InitializeComponent();
            vm.RefreshList();

            var defaults = new List <string> {
                "SUCCESS", "NONE"
            };

            //defaults.AddRange(
            //    from cType in vm.Hits.Select(v => v.Type)
            //    group cType by cType into g
            //    select g.Key);
            //defaults = defaults.Distinct().ToList();

            foreach (string i in defaults.Concat(SB.Settings.Environment.GetCustomKeychainNames()))
            {
                if (!typeFilterCombobox.Items.Contains(i))
                {
                    typeFilterCombobox.Items.Add(i);
                }
            }

            typeFilterCombobox.SelectedIndex = 0;

            configFilterCombobox.Items.Add(HitsDBViewModel.defaultFilter);
            foreach (string c in vm.ConfigsList.OrderBy(c => c))
            {
                configFilterCombobox.Items.Add(c);
            }

            configFilterCombobox.SelectedIndex = 0;

            var menu     = (ContextMenu)Resources["ItemContextMenu"];
            var copyMenu = (MenuItem)menu.Items[0];
            var saveMenu = (MenuItem)menu.Items[1];

            foreach (var f in SB.Settings.Environment.ExportFormats)
            {
                MenuItem i = new MenuItem();
                i.Header = f.Format;
                i.Click += new RoutedEventHandler(copySelectedCustom_Click);
                ((MenuItem)copyMenu.Items[4]).Items.Add(i); // Here the 4 is hardcoded, it's bad but it works
            }

            foreach (var f in SB.Settings.Environment.ExportFormats)
            {
                MenuItem i = new MenuItem();
                i.Header = f.Format;
                i.Click += new RoutedEventHandler(saveSelectedCustom_Click);
                ((MenuItem)saveMenu.Items[3]).Items.Add(i); // Here the 3 is hardcoded, it's bad but it works
            }
        }
Example #2
0
        public HitsDB()
        {
            InitializeComponent();

            DataContext = vm;

            vm.RefreshList();

            var defaults = new string[] { "SUCCESS", "NONE" };

            foreach (string i in defaults.Concat(Globals.environment.GetCustomKeychainNames()))
            {
                typeFilterCombobox.Items.Add(i);
            }

            typeFilterCombobox.SelectedIndex = 0;

            configFilterCombobox.Items.Add("All");
            foreach (string c in vm.ConfigsList)
            {
                configFilterCombobox.Items.Add(c);
            }

            configFilterCombobox.SelectedIndex = 0;

            var menu     = (ContextMenu)Resources["ItemContextMenu"];
            var copyMenu = (MenuItem)menu.Items[0];
            var saveMenu = (MenuItem)menu.Items[1];

            foreach (var f in Globals.environment.ExportFormats)
            {
                MenuItem i = new MenuItem();
                i.Header = f.Format;
                i.Click += new RoutedEventHandler(copySelectedCustom_Click);
                ((MenuItem)copyMenu.Items[4]).Items.Add(i); // Here the 4 is hardcoded, it's bad but it works
            }

            foreach (var f in Globals.environment.ExportFormats)
            {
                MenuItem i = new MenuItem();
                i.Header = f.Format;
                i.Click += new RoutedEventHandler(saveSelectedCustom_Click);
                ((MenuItem)saveMenu.Items[3]).Items.Add(i); // Here the 3 is hardcoded, it's bad but it works
            }
        }