private void Button_Click_Remove(object sender, RoutedEventArgs e) { if (ListView.SelectedValue == null) { return; } //AnimeInfo toRemove = dict[this.ComboBox.SelectedIndex].FirstOrDefault(x => x.ID == (ListView.SelectedValue as AnimeInfo).ID); dict[this.ComboBox.SelectedIndex].Remove(ListView.SelectedValue as AnimeInfo); this.ListView.Items.Refresh(); JsonManager.Save(dict); }
private void Button_Click_Add(object sender, RoutedEventArgs e) { AddDialogBox addDialogBox = new AddDialogBox(); addDialogBox.Owner = this; addDialogBox.ShowDialog(); if (addDialogBox.DialogResult == true) { dict[this.ComboBox.SelectedIndex].Add(addDialogBox.AnimeResult); } this.ListView.Items.Refresh(); JsonManager.Save(dict); }
private void Button_Click_Move_To(object sender, RoutedEventArgs e) { if (ListView.SelectedValue == null) { return; } MenuItem menuItem = sender as MenuItem; int selectedList = this.ComboBox.SelectedIndex; int listToSendTo = -1; switch (menuItem.Header) { case "Currently Watching": listToSendTo = 0; break; case "Up To Date": listToSendTo = 1; break; case "Finished": listToSendTo = 2; break; case "Queue": listToSendTo = 3; break; } if (selectedList == listToSendTo) { return; } AnimeInfo animeToMove = ListView.SelectedValue as AnimeInfo; dict[selectedList].Remove(animeToMove); dict[listToSendTo].Add(animeToMove); this.ListView.Items.Refresh(); JsonManager.Save(dict); }
private void Button_Click_Up(object sender, RoutedEventArgs e) { if (ListView.SelectedValue == null) { return; } AnimeInfo selectedAnime = ListView.SelectedValue as AnimeInfo; List <AnimeInfo> animeInfo = dict[this.ComboBox.SelectedIndex]; int index = animeInfo.FindIndex(x => x == selectedAnime) - 1; if (index >= 0) { animeInfo.Remove(ListView.SelectedItem as AnimeInfo); animeInfo.Insert(index, selectedAnime); } this.ListView.Items.Refresh(); JsonManager.Save(dict); }
private void Button_Click_Edit(object sender, RoutedEventArgs e) { if (ListView.SelectedValue == null) { return; } AnimeInfo animeInfo = ListView.SelectedValue as AnimeInfo; AddDialogBox addDialogBox = new AddDialogBox("Edit Anime", animeInfo.Name, animeInfo.SeasonCount, animeInfo.EpisodeCount, animeInfo.Url); addDialogBox.Owner = this; addDialogBox.ShowDialog(); if (addDialogBox.DialogResult == false) { return; } AnimeInfo result = addDialogBox.AnimeResult; animeInfo.Name = result.Name; animeInfo.SeasonCount = result.SeasonCount; animeInfo.EpisodeCount = result.EpisodeCount; animeInfo.Url = result.Url; this.ListView.Items.Refresh(); JsonManager.Save(dict); }