protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            if (e.Parameter != null)
            {
                await PokeDataLayer.getPokemonFamiliy(Convert.ToInt32((e.Parameter as Pokemon).number), this.currentPokemons);

                this.pokemonFamilyPivot.Background = new SolidColorBrush(Colors.Transparent);
                // this.pokemonFamilyPivot.Foreground = new SolidColorBrush(Colors.White);
                int i = 0, n = 0;
                foreach (Pokemon pokemon in this.currentPokemons)
                {
                    var pivotItem = new PivotItem();
                    var frame     = new Frame();
                    frame.Navigate(typeof(FeaturePage), pokemon);
                    frame.Margin      = new Thickness(0);
                    frame.Padding     = new Thickness(0);
                    pivotItem.Margin  = new Thickness(0);
                    pivotItem.Padding = new Thickness(0);
                    pivotItem.Content = frame;
                    TextBlock txtbl = new TextBlock();
                    txtbl.Text       = pokemon.name;
                    txtbl.Foreground = new SolidColorBrush(Colors.White);
                    pivotItem.Header = txtbl;
                    if (Convert.ToInt32((e.Parameter as Pokemon).number) == Convert.ToInt32(pokemon.number))
                    {
                        n = i;
                        this.currentPokemon = pokemon;
                        this.bgImage.Source = new BitmapImage(new Uri("ms-appx://" + currentPokemon.bgImageSource));
                        Debug.WriteLine(new Uri("ms-appx://" + currentPokemon.bgImageSource).ToString());
                    }
                    this.pokemonFamilyPivot.Items.Add(pivotItem);
                    i++;
                }
                this.pokemonFamilyPivot.SelectedIndex = n;
            }
            base.OnNavigatedTo(e);
        }
Beispiel #2
0
 private async void Page_Loaded(object sender, RoutedEventArgs e)
 {
     await PokeDataLayer.getAllPokemon(pokemonList);
 }