private void parseComboBoxItems()
        {
            string        file     = Path.Combine(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location), "characters.json");
            string        contents = File.ReadAllText(file);
            CharacterList list     = JsonConvert.DeserializeObject <CharacterList>(contents);

            foreach (Character c in list.characters)
            {
                ComboboxItem item = new ComboboxItem();
                item.Text  = c.name;
                item.Value = c;
                Player1Character.Items.Add(item);
                Player2Character.Items.Add(item);
            }
            Player1Character.SelectedIndex = 0;
            Player2Character.SelectedIndex = 0;


            string      sponsors         = Path.Combine(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location), "sponsors.json");
            string      sponsorsContents = File.ReadAllText(sponsors);
            SponsorList sponsorslist     = JsonConvert.DeserializeObject <SponsorList>(sponsorsContents);

            foreach (Sponsor s in sponsorslist.sponsors)
            {
                ComboboxItem item = new ComboboxItem();
                item.Text  = s.name;
                item.Value = s;
                Player1Sponsor.Items.Add(item);
                Player2Sponsor.Items.Add(item);
            }
            Player1Character.SelectedIndex = 0;
            Player2Character.SelectedIndex = 0;
            Player1Sponsor.SelectedIndex   = 0;
            Player2Sponsor.SelectedIndex   = 0;
        }
Beispiel #2
0
        private void parseComboBoxItems()
        {
            string        file     = Path.Combine(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location), "characters.json");
            string        contents = File.ReadAllText(file);
            CharacterList list     = JsonConvert.DeserializeObject <CharacterList>(contents);

            foreach (Character c in list.characters)
            {
                ComboboxItem item = new ComboboxItem();
                item.Text  = c.name;
                item.Value = c;
                Player1Character.Items.Add(item);
                Player2Character.Items.Add(item);

                crewCharA1.Items.Add(item);
                crewCharA2.Items.Add(item);
                crewCharA3.Items.Add(item);
                crewCharA4.Items.Add(item);
                crewCharA5.Items.Add(item);

                crewCharB1.Items.Add(item);
                crewCharB2.Items.Add(item);
                crewCharB3.Items.Add(item);
                crewCharB4.Items.Add(item);
                crewCharB5.Items.Add(item);
            }
            Player1Character.SelectedIndex = 0;
            Player2Character.SelectedIndex = 0;
            Player1Character.Sorted        = true;
            Player2Character.Sorted        = true;

            crewCharA1.Sorted = true;
            crewCharA2.Sorted = true;
            crewCharA3.Sorted = true;
            crewCharA4.Sorted = true;
            crewCharA5.Sorted = true;

            crewCharB1.Sorted = true;
            crewCharB2.Sorted = true;
            crewCharB3.Sorted = true;
            crewCharB4.Sorted = true;
            crewCharB5.Sorted = true;

            crewCharA1.SelectedIndex = 0;
            crewCharA2.SelectedIndex = 0;
            crewCharA3.SelectedIndex = 0;
            crewCharA4.SelectedIndex = 0;
            crewCharA5.SelectedIndex = 0;

            crewCharB1.SelectedIndex = 0;
            crewCharB2.SelectedIndex = 0;
            crewCharB3.SelectedIndex = 0;
            crewCharB4.SelectedIndex = 0;
            crewCharB5.SelectedIndex = 0;

            string      sponsors         = Path.Combine(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location), "sponsors.json");
            string      sponsorsContents = File.ReadAllText(sponsors);
            SponsorList sponsorslist     = JsonConvert.DeserializeObject <SponsorList>(sponsorsContents);

            foreach (Sponsor s in sponsorslist.sponsors)
            {
                ComboboxItem item = new ComboboxItem();
                item.Text  = s.name;
                item.Value = s;
                Player1Sponsor.Items.Add(item);
                Player2Sponsor.Items.Add(item);
            }
            Player1Character.SelectedIndex = 0;
            Player2Character.SelectedIndex = 0;
            Player1Sponsor.SelectedIndex   = 0;
            Player2Sponsor.SelectedIndex   = 0;
            string   flags         = Path.Combine(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location), "flags.json");
            string   flagsContents = File.ReadAllText(flags);
            FlagList flagsList     = JsonConvert.DeserializeObject <FlagList>(flagsContents);

            foreach (Flag flag in flagsList.flags)
            {
                ComboboxItem item = new ComboboxItem();
                item.Text  = flag.name;
                item.Value = flag;
                FlagsCombo.Items.Add(item);
                FlagsComboP2.Items.Add(item);
            }
            FlagsCombo.SelectedIndex   = 0;
            FlagsComboP2.SelectedIndex = 0;
        }