コード例 #1
0
 private void ToggleExpansions_Click(object sender, EventArgs e)
 {
     for (int i = 0; i < ListExpansions.Items.Count; i++)
     {
         ListExpansions.SetItemChecked(i, !ListExpansions.GetItemChecked(i));
     }
 }
コード例 #2
0
        private void ButtonOK_Click(object sender, EventArgs e)
        {
            bool negate = false;

            // factions
            negate = ((ListFactions.CheckedItems.Count * 2) > ListFactions.Items.Count);
            for (int i = 0; i < ListFactions.Items.Count; i++)
            {
                if (ListFactions.GetItemChecked(i) != negate)
                {
                    AllowedFactions.Add(ListFactions.Items[i].ToString());
                }
            }
            NegateFactions = negate;


            // classes
            negate = ((ListClasses.CheckedItems.Count * 2) > ListClasses.Items.Count);
            for (int i = 0; i < ListClasses.Items.Count; i++)
            {
                if (ListClasses.GetItemChecked(i) != negate)
                {
                    AllowedClasses.Add(ListClasses.Items[i].ToString());
                }
            }
            NegateClasses = negate;


            // races
            negate = ((ListRaces.CheckedItems.Count * 2) > ListRaces.Items.Count);
            for (int i = 0; i < ListRaces.Items.Count; i++)
            {
                if (ListRaces.GetItemChecked(i) != negate)
                {
                    AllowedRaces.Add(ListRaces.Items[i].ToString());
                }
            }
            NegateRaces = negate;


            // rarities
            negate = ((ListRarities.CheckedItems.Count * 2) > ListRarities.Items.Count);
            for (int i = 0; i < ListRarities.Items.Count; i++)
            {
                if (ListRarities.GetItemChecked(i) != negate)
                {
                    AllowedRarities.Add(ListRarities.Items[i].ToString());
                }
            }
            NegateRarities = negate;


            // expansions
            negate = ((ListExpansions.CheckedItems.Count * 2) > ListExpansions.Items.Count);
            for (int i = 0; i < ListExpansions.Items.Count; i++)
            {
                if (ListExpansions.GetItemChecked(i) != negate)
                {
                    AllowedExpansions.Add(ListExpansions.Items[i].ToString());
                }
            }
            NegateExpansions = negate;



            Close();
        }