public void UpdateContentView(AnimeListBox listBox, GroupBox contentBox) { String tag = listBox.Tag as String; TabPages listPage = (TabPages)Enum.Parse(typeof(TabPages), tag); AnimeItem item = listBox.SelectedItem as AnimeItem; Anime anime = _model.GetAnimes((int)listPage)[listBox.SelectedIndex]; foreach (Control control in contentBox.Controls) { String controlTag = control.Tag as String; if (controlTag == "Banner") { (control as PictureBox).Image = item.Banner; } else if (controlTag == "Title") { (control as Label).Text = anime.Title; } else if (controlTag == "Description") { (control as Label).Text = anime.Description; } } }
public void UpdateListBox(AnimeListBox listBox) { String tag = listBox.Tag as String; int selectedIndex = listBox.SelectedIndex; TabPages listPage = (TabPages)Enum.Parse(typeof(TabPages), tag); Anime[] animes = _model.GetAnimes((int)listPage); AnimeItem[] items = new AnimeItem[animes.Length]; for (int i = 0; i < animes.Length; i++) { items[i] = new AnimeItem(animes[i].BannerPath); } listBox.Items.Clear(); listBox.Items.AddRange(items); listBox.SelectedIndex = selectedIndex; }