示例#1
0
        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);
            }
        }
示例#2
0
        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_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);
            }
        }
示例#4
0
        private void CommandBinding_DeleteBookmark(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;
                }

                MessageBoxResult res = MessageBox.Show(string.Format("Are you sure you want to delete this bookmark: {0}", ba.AniDB_Anime.FormattedTitle),
                                                       "Confirm", MessageBoxButton.YesNo, MessageBoxImage.Warning);

                if (res == MessageBoxResult.Yes)
                {
                    this.Cursor = Cursors.Wait;
                    string result = JMMServerVM.Instance.clientBinaryHTTP.DeleteBookmarkedAnime(ba.BookmarkedAnimeID.Value);
                    if (result.Length > 0)
                    {
                        MessageBox.Show(result, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                    }
                    else
                    {
                        MainListHelperVM.Instance.BookmarkedAnime.Remove(ba);
                    }
                }
            }
            catch (Exception ex)
            {
                Utils.ShowErrorMessage(ex);
            }
            finally
            {
                this.Cursor = Cursors.Arrow;
            }
        }
示例#5
0
        public void RefreshBookmarkedAnime()
        {
            try
            {
                // set this to null so that it will be refreshed the next time it is needed

                List <JMMServerBinary.Contract_BookmarkedAnime> baRaw = JMMServerVM.Instance.clientBinaryHTTP.GetAllBookmarkedAnime();

                //if (baRaw.Count == 0) return;

                System.Windows.Application.Current.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, (Action) delegate()
                {
                    BookmarkedAnime.Clear();

                    // must series before groups the binding is based on the groups, and will refresh when that is changed
                    foreach (JMMServerBinary.Contract_BookmarkedAnime contract in baRaw)
                    {
                        BookmarkedAnimeVM ba = new BookmarkedAnimeVM(contract);

                        if (ba.DownloadingBool && BookmarkFilter_Downloading)
                        {
                            BookmarkedAnime.Add(ba);
                        }

                        if (ba.NotDownloadingBool && BookmarkFilter_NotDownloading)
                        {
                            BookmarkedAnime.Add(ba);
                        }
                    }
                    ViewBookmarkedAnime.Refresh();
                });
            }
            catch (Exception ex)
            {
                Utils.ShowErrorMessage(ex);
            }
        }
示例#6
0
        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);
            }
        }
示例#7
0
        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;
                    }
                }
            }
        }