Example #1
0
        public List <Pokemon> GetAllPokemonOfType(Pokemon.PokemonType type)
        {
            // create list to save pokemon of same type
            PokeDex pokemons = new PokeDex();

            // check each pokemon for the matching type
            foreach (Pokemon pokemon in this)
            {
                if (pokemon.Type1 == type || pokemon.Type2 == type)
                {
                    pokemons.Add(pokemon);
                }
            }

            // return a PokeDex containing only pokemon of matching type
            return(pokemons);
        }
Example #2
0
 private void TypeFilter_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     // check if filter is selected
     if (TypeFilter.SelectedIndex != 0)
     {
         // Set the selectedType to the correct Enum and filter list by type
         Pokemon.PokemonType selectedType =
             (Pokemon.PokemonType)Enum.Parse(typeof(Pokemon.PokemonType), TypeFilter.SelectedItem.ToString(), true);
         PokedexListbox.ItemsSource = pokedexLoader.GetAllPokemonOfType(selectedType);
         PokedexListbox.Items.Refresh();
     }
     else
     {
         PokedexListbox.ItemsSource = pokedexLoader;
         Update();
     }
 }
Example #3
0
 private void bulbasaurBtn_Click(object sender, EventArgs e)
 {
     SelectedType = Pokemon.PokemonType.Bulbasaur;
 }
Example #4
0
 private void squirtleBtn_Click(object sender, EventArgs e)
 {
     SelectedType = Pokemon.PokemonType.Squirtle;
 }
Example #5
0
 private void slowpokeBtn_Click(object sender, EventArgs e)
 {
     SelectedType = Pokemon.PokemonType.Slowpoke;
 }
Example #6
0
 private void pikachuBtn_Click(object sender, EventArgs e)
 {
     SelectedType = Pokemon.PokemonType.Pikachu;
 }
Example #7
0
        private void MainForm_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.Control)
            {
                switch(e.KeyCode)
                {
                    case Keys.G:
                        CurrentMode = Mode.Grow;
                        break;
                    case Keys.F:
                        CurrentMode = Mode.Shrink;
                        break;
                    case Keys.E:
                        CurrentMode = Mode.Erase;
                        break;
                    case Keys.W:
                        CurrentMode = Mode.Selection;
                        break;
                    case Keys.D:
                        CurrentMode = Mode.Duplicate;
                        break;
                    case Keys.X:
                        CurrentMode = Mode.Move;
                        break;
                    case Keys.N:
                        NewDrawing();
                        break;
                    case Keys.Z:
                        Drawing.Undo();
                        Drawing.RefreshDrawing();
                        break;
                    case Keys.Q:
                        Close();
                        break;
                    case Keys.L:
                        LoadDrawing();
                        break;
                    case Keys.S:
                        SaveDrawing();
                        break;

                }
            }
            switch (e.KeyCode)
            {
                case Keys.B:
                    SelectedType = Pokemon.PokemonType.Bulbasaur;
                    break;
                case Keys.S:
                    SelectedType = Pokemon.PokemonType.Squirtle;
                    break;
                case Keys.C:
                    SelectedType = Pokemon.PokemonType.Charmander;
                    break;
                case Keys.P:
                    SelectedType = Pokemon.PokemonType.Pikachu;
                    break;
                case Keys.L:
                    SelectedType = Pokemon.PokemonType.Slowpoke;
                    break;
                case Keys.D:
                    SelectedType = Pokemon.PokemonType.Diglett;
                    break;
            }
        }
Example #8
0
 private void diglettBtn_Click(object sender, EventArgs e)
 {
     SelectedType = Pokemon.PokemonType.Diglett;
 }
Example #9
0
 private void charmanderBtn_Click(object sender, EventArgs e)
 {
     SelectedType = Pokemon.PokemonType.Charmander;
 }