private void CommandBinding_EditNotes(object sender, ExecutedRoutedEventArgs e) { Window parentWindow = Window.GetWindow(this); try { object obj = e.Parameter; if (obj == null) { return; } BookmarkedAnimeVM ba = obj as BookmarkedAnimeVM; if (ba == null) { return; } DialogTextMultiline dlg = new DialogTextMultiline(); dlg.Init("Notes: ", ba.Notes); dlg.Owner = Window.GetWindow(this); bool?res = dlg.ShowDialog(); if (res.HasValue && res.Value) { ba.Notes = dlg.EnteredText; ba.Save(); } } catch (Exception ex) { Utils.ShowErrorMessage(ex); } }
private void CommandBinding_ToggleDownloading(object sender, ExecutedRoutedEventArgs e) { Window parentWindow = Window.GetWindow(this); try { object obj = e.Parameter; if (obj == null) { return; } BookmarkedAnimeVM ba = obj as BookmarkedAnimeVM; if (ba == null) { return; } bool newStatus = !ba.DownloadingBool; ba.Downloading = newStatus ? 1 : 0; ba.Save(); } catch (Exception ex) { Utils.ShowErrorMessage(ex); } }
private void CommandBinding_EditPriority(object sender, ExecutedRoutedEventArgs e) { Window parentWindow = Window.GetWindow(this); try { object obj = e.Parameter; if (obj == null) { return; } BookmarkedAnimeVM ba = obj as BookmarkedAnimeVM; if (ba == null) { return; } DialogInteger dlg = new DialogInteger(); dlg.Init(Properties.Resources.Bookmarks_Priority + " ", ba.Priority, 1, 100); dlg.Owner = Window.GetWindow(this); bool?res = dlg.ShowDialog(); if (res.HasValue && res.Value) { ba.Priority = dlg.EnteredInteger; ba.Save(); } } catch (Exception ex) { Utils.ShowErrorMessage(ex); } }
protected override void OnShowContextMenu() { try { GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU); if (dlg == null) { return; } dlg.Reset(); dlg.SetHeading("Calendar"); dlg.Add("Search for Torrents"); dlg.Add("Bookmark this Anime"); dlg.Add("Create Series for Anime"); dlg.DoModal(GUIWindowManager.ActiveWindow); switch (dlg.SelectedId) { case 1: AniDB_AnimeVM anime2 = null; if ((anime2 = this.m_Facade.SelectedListItem.TVTag as AniDB_AnimeVM) != null) { DownloadHelper.SearchAnime(anime2); } break; case 2: AniDB_AnimeVM anime3 = null; if ((anime3 = this.m_Facade.SelectedListItem.TVTag as AniDB_AnimeVM) != null) { BookmarkedAnimeVM bookmark = new BookmarkedAnimeVM(); bookmark.AnimeID = anime3.AnimeID; bookmark.Downloading = 0; bookmark.Notes = ""; bookmark.Priority = 1; if (bookmark.Save()) { Utils.DialogMsg("Success", "Bookmark Created"); } } break; case 3: AniDB_AnimeVM anime4 = null; if ((anime4 = this.m_Facade.SelectedListItem.TVTag as AniDB_AnimeVM) != null) { JMMServerBinary.Contract_AnimeSeries_SaveResponse resp = JMMServerVM.Instance.clientBinaryHTTP.CreateSeriesFromAnime( anime4.AnimeID, null, JMMServerVM.Instance.CurrentUser.JMMUserID); if (string.IsNullOrEmpty(resp.ErrorMessage)) { Utils.DialogMsg("Success", "Series Created"); } else { Utils.DialogMsg("Error", resp.ErrorMessage); } } break; } } catch (Exception ex) { BaseConfig.MyAnimeLog.Write("Error in menu: {0}", ex); } }
protected override void OnShowContextMenu() { GUIListItem currentitem = this.m_Facade.SelectedListItem; if (currentitem == null) { return; } if (currentitem.TVTag.GetType() == typeof(RecommendationVM)) { RecommendationVM rec = currentitem.TVTag as RecommendationVM; if (rec != null) { GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU); if (dlg == null) { return; } dlg.Reset(); dlg.SetHeading(rec.Recommended_DisplayName); dlg.Add("Don't Show This Anime (Ignore)"); dlg.Add("Bookmark this Anime"); dlg.Add("Create Series for Anime"); dlg.DoModal(GUIWindowManager.ActiveWindow); switch (dlg.SelectedLabel) { case 0: int recType = 1; if (dummyModeDownload != null && dummyModeDownload.Visible) { recType = 2; } JMMServerVM.Instance.clientBinaryHTTP.IgnoreAnime(rec.RecommendedAnimeID, recType, JMMServerVM.Instance.CurrentUser.JMMUserID); LoadData(); break; case 1: BookmarkedAnimeVM bookmark = new BookmarkedAnimeVM(); bookmark.AnimeID = rec.RecommendedAnimeID; bookmark.Downloading = 0; bookmark.Notes = ""; bookmark.Priority = 1; if (bookmark.Save()) { Utils.DialogMsg("Success", "Bookmark Created"); } break; case 2: JMMServerBinary.Contract_AnimeSeries_SaveResponse resp = JMMServerVM.Instance.clientBinaryHTTP.CreateSeriesFromAnime( rec.RecommendedAnimeID, null, JMMServerVM.Instance.CurrentUser.JMMUserID); if (string.IsNullOrEmpty(resp.ErrorMessage)) { Utils.DialogMsg("Success", "Series Created"); } else { Utils.DialogMsg("Error", resp.ErrorMessage); } break; } } } }