private void addChamp_Click(object sender, RoutedEventArgs e)
        {
            Champion      champ      = getSelectedChampion();
            ChampionGroup champGroup = getSelectedChampionGroup();

            if (champ == null || champGroup == null || champListBox.Items.Contains(champ))
            {
                return;
            }

            champListBox.Items.Add(champ);
            champGroup.AddChamp(champ);
        }
Пример #2
0
        public static string GetNewChampion()
        {
            ChampionGroup group = ChampionGroup.selected;

            if (group == null)
            {
                currChampId = champs[rng.Next(champs.Count)];
            }
            else
            {
                currChampId = group.GetRandom();
            }
            return(currChampId);
        }
        private void champList_KeyDown(object sender, System.Windows.Input.KeyEventArgs e)
        {
            if (e.Key == System.Windows.Input.Key.Enter)
            {
                Champion      champ      = getSelectedChampion();
                ChampionGroup champGroup = getSelectedChampionGroup();

                if (champ == null || champGroup == null || champListBox.Items.Contains(champ))
                {
                    return;
                }

                champListBox.Items.Add(champ);
                champGroup.AddChamp(champ);
            }
            ;
        }
        private void removeChamp_Click(object sender, RoutedEventArgs e)
        {
            Champion champ = champListBox.SelectedValue as Champion;

            if (champ == null)
            {
                return;
            }
            if (!champListBox.Items.Contains(champ))
            {
                return;
            }

            champListBox.Items.Remove(champ);

            ChampionGroup champGroup = getSelectedChampionGroup();

            champGroup.RemoveChamp(champ);
        }
        private void addGroup_Click(object sender, RoutedEventArgs e)
        {
            string text = groupName.Text;

            if ((text == "Group Name") || ChampionGroup.Find(text) != null)
            {
                return;
            }

            ChampionGroup group = new ChampionGroup(text);

            ChampionGroup.groups.Add(group);

            ComboBoxItem item = new ComboBoxItem();

            item.Content    = group;
            item.IsSelected = true;
            groupList.Items.Add(item);
        }
        private void removeGroup_Click(object sender, RoutedEventArgs e)
        {
            if (groupList.SelectedItem == null)
            {
                return;
            }
            ChampionGroup group = getSelectedChampionGroup();

            groupList.Items.Remove((ComboBoxItem)groupList.SelectedItem);

            ChampionGroup.groups.Remove(group);

            if (groupList.Items.Count > 0)
            {
                ((ComboBoxItem)groupList.Items[0]).IsSelected = true;
            }
            else
            {
                champListBox.Items.Clear();
            }
        }