public override Task OnNavigatedFromAsync(IDictionary <string, object> pageState, bool suspending) { if (suspending) { pageState[nameof(PokemonFoundAndSeen)] = PokemonFoundAndSeen; pageState[nameof(SeenPokemons)] = SeenPokemons; pageState[nameof(CapturedPokemons)] = CapturedPokemons; } else { pageState?.Clear(); PokemonFoundAndSeen?.Clear(); EeveeEvolutions?.Clear(); PokemonEvolutions?.Clear(); } NavigationService.FrameFacade.BackRequested -= FrameFacade_BackRequested; return(Task.CompletedTask); }
private void PopulateEvolutions() { PokemonEvolutions.Clear(); EeveeEvolutions.Clear(); IsEevee = false; PokemonId InitPokemon = SelectedPokedexEntry.Key; PokemonSettings CurrPokemon = PokemonDetails; switch (InitPokemon) { case PokemonId.Eevee: case PokemonId.Jolteon: case PokemonId.Flareon: case PokemonId.Vaporeon: InitPokemon = PokemonId.Eevee; CurrPokemon = GameClient.GetExtraDataForPokemon(InitPokemon); foreach (var ev in CurrPokemon.EvolutionIds) { EeveeEvolutions.Add(new KeyValuePair <PokemonId, PokedexEntry>(ev, GetPokedexEntry(ev))); } PokemonEvolutions.Add(new KeyValuePair <PokemonId, PokedexEntry>(PokemonId.Eevee, GetPokedexEntry(PokemonId.Eevee))); IsEevee = true; break; default: PokemonEvolutions.Add(new KeyValuePair <PokemonId, PokedexEntry>(InitPokemon, GetPokedexEntry(InitPokemon))); while (CurrPokemon.ParentPokemonId != PokemonId.Missingno) { PokemonEvolutions.Insert(0, new KeyValuePair <PokemonId, PokedexEntry>(CurrPokemon.ParentPokemonId, GetPokedexEntry(CurrPokemon.ParentPokemonId))); CurrPokemon = GameClient.GetExtraDataForPokemon(CurrPokemon.ParentPokemonId); } CurrPokemon = PokemonDetails; while (CurrPokemon.EvolutionIds.Count > 0) { foreach (var ev in CurrPokemon.EvolutionIds) //for Eevee { PokemonEvolutions.Add(new KeyValuePair <PokemonId, PokedexEntry>(ev, GetPokedexEntry(ev))); } CurrPokemon = GameClient.GetExtraDataForPokemon(CurrPokemon.EvolutionIds.ElementAt(0)); } break; } }
public override Task OnNavigatedFromAsync(IDictionary <string, object> pageState, bool suspending) { if (suspending) { pageState[nameof(PokemonFoundAndSeen)] = PokemonFoundAndSeen; pageState[nameof(SeenPokemons)] = SeenPokemons; pageState[nameof(CapturedPokemons)] = CapturedPokemons; if (IsPokemonDetailsOpen) { pageState[nameof(IsPokemonDetailsOpen)] = IsPokemonDetailsOpen; pageState[nameof(SelectedPokedexEntry)] = SelectedPokedexEntry; pageState[nameof(IsEevee)] = IsEevee; } } else { pageState?.Clear(); PokemonFoundAndSeen?.Clear(); EeveeEvolutions?.Clear(); PokemonEvolutions?.Clear(); } return(Task.CompletedTask); }