// on selection changed private void factionList_SelectionChanged(object sender, SelectionChangedEventArgs e) { int index = factionList.SelectedIndex; // fill the page with faction logo if (0 <= index && index < FactionList.Factions().Count) { // fill the url string Url = "/FactionPage.xaml?index=" + index; NavigationService.Navigate(new Uri(Url, UriKind.Relative)); } }
public void loadImage() { //MiniImage.Source = FactionList.Factions()[factIndex].Characters[charIndex].MinisImage; MiniImage.Source = Image.Get(FactionList.Factions()[factIndex].Characters[charIndex].MinisPath); int cnt = 1; BitmapImage img; // foreach (BitmapImage img in FactionList.Factions()[factIndex].Characters[charIndex].ProfileImage) foreach (string path in FactionList.Factions()[factIndex].Characters[charIndex].ProfilePaths) { img = Image.Get(path); switch (cnt) { case 1: ProfileImageFirst_1.Source = img; ProfileImageBack_1.Source = img; break; case 2: ProfileImageFirst_2.Source = img; ProfileImageBack_2.Source = img; break; case 3: ProfileImageFirst_3.Source = img; ProfileImageBack_3.Source = img; break; case 4: ProfileImageFirst_4.Source = img; ProfileImageBack_4.Source = img; break; case 5: ProfileImageFirst_5.Source = img; ProfileImageBack_5.Source = img; break; } cnt += 1; } cnt *= 2; cnt -= 1; int max = Pivot.Items.Count; for (int i = cnt; i < max; i++) { Pivot.Items.RemoveAt(Pivot.Items.Count - 1); } //if (FactionList.Factions()[factIndex].Characters[charIndex].MinisImage == null) if (MiniImage.Source == null) { Pivot.Items.RemoveAt(0); } }
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e) { string charIndexStr, factIndexStr; if (NavigationContext.QueryString.TryGetValue("charIndex", out charIndexStr) && NavigationContext.QueryString.TryGetValue("factIndex", out factIndexStr)) { charIndex = int.Parse(charIndexStr); factIndex = int.Parse(factIndexStr); ChangeColor(FactionList.Factions()[factIndex].Name); loadImage(); } base.OnNavigatedTo(e); }
// on page load protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e) { string indexStr; if (NavigationContext.QueryString.TryGetValue("index", out indexStr)) { // get the faction index currentFactionIndex = int.Parse(indexStr); // get the faction corresponding to the index currentFaction = FactionList.Factions()[currentFactionIndex]; // initialize the title PageTitle.Text = currentFaction.Name; // fill the list characterList.ItemsSource = currentFaction.Characters; // set the background image BackgroundImage.ImageSource = Image.Get(currentFaction.LogoPath); // set the text color ChangeColor(currentFaction.Name); } base.OnNavigatedTo(e); }
/* * This class correspond to the catalog entry. * It will be automatically filled using the FactionList class. */ public Catalog() { InitializeComponent(); // initialize the faction list factionList.ItemsSource = FactionList.Factions(); }