private void OnWindowClosing(object sender, System.ComponentModel.CancelEventArgs e) { if (playerCry != null) { playerCry.Close(); } if (playerEvolutionCry != null) { playerEvolutionCry.Close(); } playerMusic.Close(); ushort[] moves = PokemonDatabase.GetMovesLearnedAtLevel(pokemon); foreach (ushort moveID in moves) { Move move = new Move(moveID); if (pokemon.NumMoves == 4) { var result = LearnMoveWindow.ShowDialog(Window.GetWindow(this), pokemon, move.ID); if (result.HasValue && result.Value) { TriggerMessageBox.Show(this, pokemon.Nickname + " learned " + move.MoveData.Name + "!", "Move Learned"); PokeManager.RefreshUI(); } } else { pokemon.SetMoveAt(pokemon.NumMoves, move); TriggerMessageBox.Show(this, pokemon.Nickname + " learned " + move.MoveData.Name + "!", "Move Learned"); PokeManager.RefreshUI(); } } if (shedinjaAdded) { TriggerMessageBox.Show(PokeManager.ManagerWindow, "A Shedinja has appeared from the shed exoskeleton of " + pokemon.Nickname, "New Pokémon"); } }