protected override void OnShowContextMenu()
        {
            GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU);
            MusicDatabase dbs;

            if (dlg == null)
            {
                return;
            }

            dlg.Reset();
            dlg.SetHeading(498);         // Menu

            dlg.AddLocalizedString(930); //Add to favorites

            if (CurrentTrackTag.Album != null)
            {
                dlg.AddLocalizedString(33041);
            }

            if (PluginManager.IsPluginNameEnabled2("LastFMScrobbler"))
            {
                dlg.AddLocalizedString(34010); //last.fm love
                dlg.AddLocalizedString(34011); //last.fm ban
            }

            dlg.DoModal(GetID);

            if (dlg.SelectedId == -1)
            {
                return;
            }

            switch (dlg.SelectedId)
            {
            case 928: // Find Coverart
                if (_MusicWindow != null)
                {
                    string albumFolderPath = Path.GetDirectoryName(CurrentTrackFileName);

                    _MusicWindow.FindCoverArt(false, CurrentTrackTag.Artist, CurrentTrackTag.Album, albumFolderPath,
                                              CurrentTrackTag, -1);
                    CurrentThumbFileName = GUIMusicBaseWindow.GetCoverArt(false, CurrentTrackFileName, CurrentTrackTag);

                    if (CurrentThumbFileName.Length > 0)
                    {
                        // let us test if there is a larger cover art image
                        string strLarge = Util.Utils.ConvertToLargeCoverArt(CurrentThumbFileName);
                        if (Util.Utils.FileExistsInCache(strLarge))
                        {
                            CurrentThumbFileName = strLarge;
                        }
                        AddImageToImagePathContainer(CurrentThumbFileName);

                        UpdateImagePathContainer();
                    }
                }
                break;

            case 4521: // Show Album Info
                if (_MusicWindow != null)
                {
                    string albumFolderPath = Path.GetDirectoryName(CurrentTrackFileName);
                    if (_MusicWindow != null)
                    {
                        _MusicWindow.ShowAlbumInfo(GetID, CurrentTrackTag.Artist, CurrentTrackTag.Album);
                    }
                }
                break;

            case 930: // add to favorites
                dbs = MusicDatabase.Instance;
                Song   currentSong = new Song();
                string strFile     = g_Player.Player.CurrentFile;

                bool songFound = dbs.GetSongByFileName(strFile, ref currentSong);
                if (songFound)
                {
                    if (currentSong == null)
                    {
                        return;
                    }
                    if (currentSong.Id < 0)
                    {
                        return;
                    }
                    currentSong.Favorite = true;
                    dbs.SetFavorite(currentSong);
                }
                break;

            case 33041: //Play this album
                try
                {
                    if (CurrentTrackTag != null)
                    {
                        dbs = MusicDatabase.Instance;
                        ArrayList albumSongs = new ArrayList();
                        String    strAlbum   = CurrentTrackTag.Album;

                        bool albumSongsFound = dbs.GetSongsByAlbum(strAlbum, ref albumSongs);

                        if (albumSongsFound)
                        {
                            for (int i = albumSongs.Count - 1; i >= 0; i--)
                            {
                                Song song = (Song)albumSongs[i];
                                if (song.Title != CurrentTrackTag.Title && song.Artist == CurrentTrackTag.Artist)
                                {
                                    AddSongToPlaylist(ref song);
                                }
                            }
                            OnSongInserted();
                        }
                    }
                }
                catch (Exception ex)
                {
                    Log.Error("GUIMusicPlayingNow: error while adding album tracks for {0} - {1}", CurrentTrackTag.Album,
                              ex.Message);
                }
                break;
            }
        }
Esempio n. 2
0
        protected override void OnClicked(int controlId, GUIControl control, Action.ActionType actionType)
        {
            // we don't want the user to start another search while one is already active
            if (_workerCompleted == false)
            {
                return;
            }

            // Here we want to open the OSD Keyboard to enter the searchstring
            if (control == buttonSearch)
            {
                // If the search Button was clicked we need to bring up the search keyboard.
                VirtualKeyboard keyboard = (VirtualKeyboard)GUIWindowManager.GetWindow((int)Window.WINDOW_VIRTUAL_KEYBOARD);
                if (null == keyboard)
                {
                    return;
                }
                string searchterm = string.Empty;
                //keyboard.IsSearchKeyboard = true;
                keyboard.Reset();
                keyboard.Text = "";
                keyboard.DoModal(GetID); // show it...

                Log.Info("Wikipedia: OSD keyboard loaded!");

                // If input is finished, the string is saved to the searchterm var.
                if (keyboard.IsConfirmed)
                {
                    searchterm = keyboard.Text;

                    // If there was a string entered try getting the article.
                    if (searchterm != "")
                    {
                        Log.Info("Wikipedia: Searchterm gotten from OSD keyboard: {0}", searchterm);
                        GetAndDisplayArticle(searchterm);
                    }
                    // Else display an error dialog.
                    else
                    {
                        GUIDialogOK dlg = (GUIDialogOK)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_OK);
                        dlg.SetHeading(GUILocalizeStrings.Get(257));  // Error
                        dlg.SetLine(1, GUILocalizeStrings.Get(2500)); // No searchterm entered!
                        dlg.SetLine(2, string.Empty);
                        dlg.SetLine(3, GUILocalizeStrings.Get(2501)); // Please enter a valid searchterm!
                        dlg.DoModal(GUIWindowManager.ActiveWindow);
                    }
                }
            }
            // This is the control to select the local Wikipedia site.
            if (control == buttonLocal)
            {
                // Create a new selection dialog.
                GUIDialogMenu pDlgOK = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU);
                if (pDlgOK != null)
                {
                    pDlgOK.Reset();
                    pDlgOK.SetHeading(GUILocalizeStrings.Get(2502)); //Select your local Wikipedia:

                    // Add all the local sites we want to be displayed starting with int 0.
                    Settings langreader = new Settings(Config.GetFile(Config.Dir.Config, "wikipedia.xml"));
                    String   allsites   = langreader.GetValueAsString("Allsites", "sitenames", "");
                    Log.Info("Wikipedia: available sites: " + allsites);
                    String[] siteArray = allsites.Split(',');
                    for (int i = 0; i < siteArray.Length; i++)
                    {
                        int stringno = langreader.GetValueAsInt(siteArray[i], "string", 2006);
                        pDlgOK.Add(GUILocalizeStrings.Get(stringno)); //English, German, French ...
                    }

                    pDlgOK.DoModal(GetID);
                    if (pDlgOK.SelectedLabel >= 0)
                    {
                        SelectLocalWikipedia(pDlgOK.SelectedLabel, siteArray);
                    }
                }
            }
            // The Button holding the Links to other articles
            if (control == buttonLinks)
            {
                if (linkArray.Count > 0)
                {
                    // Create a new selection dialog.
                    GUIDialogMenu pDlgOK = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU);
                    if (pDlgOK != null)
                    {
                        pDlgOK.Reset();
                        pDlgOK.SetHeading(GUILocalizeStrings.Get(2505)); //Links to other articles:

                        // Add all the links from the linkarray.
                        foreach (string link in linkArray)
                        {
                            pDlgOK.Add(link);
                        }
                        pDlgOK.DoModal(GetID);
                        if (pDlgOK.SelectedLabel >= 0)
                        {
                            Log.Info("Wikipedia: new search from the links array: {0}", pDlgOK.SelectedLabelText);
                            GetAndDisplayArticle(pDlgOK.SelectedLabelText);
                        }
                    }
                }
                else
                {
                    GUIDialogOK dlg = (GUIDialogOK)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_OK);
                    dlg.SetHeading(GUILocalizeStrings.Get(257));  // Error
                    dlg.SetLine(1, GUILocalizeStrings.Get(2506)); // No Links from this article.
                    dlg.DoModal(GUIWindowManager.ActiveWindow);
                }
            }
            // The Button containing a list of all images from the article
            if (control == buttonImages)
            {
                if (imagedescArray.Count > 0)
                {
                    // Create a new selection dialog.
                    GUIDialogMenu pDlgOK = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU);
                    if (pDlgOK != null)
                    {
                        pDlgOK.Reset();
                        pDlgOK.SetHeading(GUILocalizeStrings.Get(2507)); //Images from this article

                        // Add all the images from the imagearray.
                        foreach (string image in imagedescArray)
                        {
                            pDlgOK.Add(image);
                        }
                        pDlgOK.DoModal(GetID);
                        if (pDlgOK.SelectedLabel >= 0)
                        {
                            Log.Info("Wikipedia: new search from the image array: {0}", imagedescArray[pDlgOK.SelectedId - 1]);
                            GetAndDisplayImage(imagenameArray[pDlgOK.SelectedId - 1].ToString(),
                                               imagedescArray[pDlgOK.SelectedId - 1].ToString());
                        }
                    }
                }
                else
                {
                    GUIDialogOK dlg = (GUIDialogOK)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_OK);
                    dlg.SetHeading(GUILocalizeStrings.Get(257));  // Error
                    dlg.SetLine(1, GUILocalizeStrings.Get(2508)); // No Images referenced in this article.
                    dlg.DoModal(GUIWindowManager.ActiveWindow);
                }
            }
            // Back to the text button to switch from image view
            if (control == buttonBack)
            {
                if (!txtArticle.IsVisible)
                {
                    GUIControl.ShowControl(GetID, txtArticle.GetID);
                }
                if (imageControl.IsVisible)
                {
                    GUIControl.HideControl(GetID, imageControl.GetID);
                }
                if (!searchtermLabel.IsVisible)
                {
                    GUIControl.ShowControl(GetID, searchtermLabel.GetID);
                }
                if (imagedescLabel.IsVisible)
                {
                    GUIControl.HideControl(GetID, imagedescLabel.GetID);
                }
                if (buttonBack.IsVisible)
                {
                    GUIControl.HideControl(GetID, buttonBack.GetID);
                    GUIControl.FocusControl(GetID, buttonSearch.GetID);
                }
            }
            base.OnClicked(controlId, control, actionType);
        }
Esempio n. 3
0
        protected override void OnShowContextMenu()
        {
            try
            {
                GUIListItem currentitem = this.m_Facade.SelectedListItem;
                if (currentitem == null)
                {
                    return;
                }

                VideoLocalVM vid = currentitem.TVTag as VideoLocalVM;
                if (vid == null)
                {
                    return;
                }

                GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);
                dlg.Reset();

                dlg.SetHeading("File options");
                dlg.Add("Play file");
                dlg.Add("Rehash file");
                dlg.Add("Ignore file");
                dlg.Add("Delete file from disk");

                dlg.DoModal(GUIWindowManager.ActiveWindow);

                if (dlg.SelectedId == 1)
                {
                    MainWindow.vidHandler.ResumeOrPlay(vid);
                    return;
                }

                if (dlg.SelectedId == 2)
                {
                    JMMServerVM.Instance.clientBinaryHTTP.RehashFile(vid.VideoLocalID);
                    Utils.DialogMsg("Done", "Action has been queued on server");
                    return;
                }

                if (dlg.SelectedId == 3)
                {
                    JMMServerVM.Instance.clientBinaryHTTP.SetIgnoreStatusOnFile(vid.VideoLocalID, true);
                    RefreshUnlinkedFiles();
                    return;
                }

                if (dlg.SelectedId == 4)
                {
                    if (!Utils.DialogConfirm("Are you sure you want to delete this file?"))
                    {
                        return;
                    }

                    JMMServerVM.Instance.clientBinaryHTTP.DeleteVideoLocalAndFile(vid.VideoLocalID);
                    RefreshUnlinkedFiles();
                }
            }
            catch (Exception ex)
            {
                BaseConfig.MyAnimeLog.Write("Error in menu: {0}", ex);
            }
        }
Esempio n. 4
0
        protected override void OnShowSort()
        {
            GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU);

            if (dlg == null)
            {
                return;
            }

            // Sorry for all the fuss with dlg selected index but there is a huge problem with it beacuse
            // sort methods are in enums and they are not separate per view. Because some sort methods are not
            // valid for share view we have problem with enums and dlg item index. I sorted out this by two
            // variables maxCommonSortIndex and dbSortCount but they are need to implement manually on every new
            // sort added. If there is a better way to handle this (with not meesing too much in code :)) I will
            // appreciate fix.

            dlg.Reset();
            dlg.SetHeading(495);         // Sort options
            int maxCommonSortIndex = -1; // Inrease by 1 when adding new common sort label(sort valid in share and db views))
            int dbSortCount        = 0;  // increase by one when adding new database sort label

            // Watch for enums in VideoSort.cs - must be exactly as the enum order

            // Common sorts - group 1
            dlg.AddLocalizedString(365);  // 0 name
            maxCommonSortIndex++;
            dlg.AddLocalizedString(1309); // 1 nameall
            maxCommonSortIndex++;
            dlg.AddLocalizedString(1999); // 2 Name with Duration
            maxCommonSortIndex++;
            dlg.AddLocalizedString(104);  // 3 date created (date)
            maxCommonSortIndex++;
            dlg.AddLocalizedString(105);  // 4 size
            maxCommonSortIndex++;
            dlg.AddLocalizedString(527);  // 5 watched
            maxCommonSortIndex++;

            // Database sorts - group 2
            if (GUIWindowManager.ActiveWindow == (int)Window.WINDOW_VIDEO_TITLE)
            {
                dlg.AddLocalizedString(366); // 6 year
                dbSortCount++;
                dlg.AddLocalizedString(367); // 7 rating
                dbSortCount++;
            }

            // Share sorts - group 3
            if (GUIWindowManager.ActiveWindow == (int)Window.WINDOW_VIDEOS)
            {
                dlg.AddLocalizedString(430);  // 8 CD label
                dlg.AddLocalizedString(1221); // 9 date modified
                dlg.AddLocalizedString(1220); // 10 date created
            }

            // set the focus to currently used sort method

            // we need to correct index only if sort method enum is greater then max common sort index in share view
            if (GUIWindowManager.ActiveWindow == (int)Window.WINDOW_VIDEOS && // must be share view
                (int)CurrentSortMethod > maxCommonSortIndex)
            {
                dlg.SelectedLabel = (int)CurrentSortMethod - dbSortCount;
            }
            else
            {
                dlg.SelectedLabel = (int)CurrentSortMethod;
            }

            // show dialog and wait for result
            dlg.DoModal(GetID);
            if (dlg.SelectedId == -1)
            {
                return;
            }

            CurrentSortAsc = true;
            switch (dlg.SelectedId)
            {
            case 365:
                CurrentSortMethod = VideoSort.SortMethod.Name;
                break;

            case 1309:
                CurrentSortMethod = VideoSort.SortMethod.NameAll;
                break;

            case 104:
                CurrentSortMethod = VideoSort.SortMethod.Date;
                CurrentSortAsc    = false;
                break;

            case 1221:
                CurrentSortMethod = VideoSort.SortMethod.Modified;
                CurrentSortAsc    = false;
                break;

            case 1220:
                CurrentSortMethod = VideoSort.SortMethod.Created;
                CurrentSortAsc    = false;
                break;

            case 105:
                CurrentSortMethod = VideoSort.SortMethod.Size;
                break;

            case 366:
                CurrentSortMethod = VideoSort.SortMethod.Year;
                break;

            case 367:
                CurrentSortMethod = VideoSort.SortMethod.Rating;
                break;

            case 430:
                CurrentSortMethod = VideoSort.SortMethod.Label;
                break;

            case 527:
                CurrentSortMethod = VideoSort.SortMethod.Watched;
                break;

            case 1999:
                CurrentSortMethod = VideoSort.SortMethod.Name_With_Duration;
                break;

            default:
                CurrentSortMethod = VideoSort.SortMethod.Name;
                break;
            }

            OnSort();
            GUIControl.FocusControl(GetID, btnSortBy.GetID);
        }
Esempio n. 5
0
        private void OnKeep()
        {
            GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU);

            if (dlg == null)
            {
                return;
            }
            dlg.Reset();
            dlg.SetHeading(1042);
            dlg.AddLocalizedString(1043); //Until watched
            dlg.AddLocalizedString(1044); //Until space needed
            dlg.AddLocalizedString(1045); //Until date
            dlg.AddLocalizedString(1046); //Always
            switch ((KeepMethodType)currentProgram.KeepUntil)
            {
            case KeepMethodType.UntilWatched:
                dlg.SelectedLabel = 0;
                break;

            case KeepMethodType.UntilSpaceNeeded:
                dlg.SelectedLabel = 1;
                break;

            case KeepMethodType.TillDate:
                dlg.SelectedLabel = 2;
                break;

            case KeepMethodType.Always:
                dlg.SelectedLabel = 3;
                break;
            }
            dlg.DoModal(GetID);
            if (dlg.SelectedLabel == -1)
            {
                return;
            }
            switch (dlg.SelectedId)
            {
            case 1043:
                currentProgram.KeepUntil = (int)KeepMethodType.UntilWatched;
                break;

            case 1044:
                currentProgram.KeepUntil = (int)KeepMethodType.UntilSpaceNeeded;

                break;

            case 1045:
                currentProgram.KeepUntil = (int)KeepMethodType.TillDate;
                dlg.Reset();
                dlg.ShowQuickNumbers = false;
                dlg.SetHeading(1045);
                for (int iDay = 1; iDay <= 100; iDay++)
                {
                    DateTime dt = currentProgram.StartTime.AddDays(iDay);
                    if (currentProgram.StartTime < DateTime.Now)
                    {
                        dt = DateTime.Now.AddDays(iDay);
                    }

                    dlg.Add(dt.ToLongDateString());
                }
                TimeSpan ts = (currentProgram.KeepUntilDate - currentProgram.StartTime);
                if (currentProgram.StartTime < DateTime.Now)
                {
                    ts = (currentProgram.KeepUntilDate - DateTime.Now);
                }
                int days = (int)ts.TotalDays;
                if (days >= 100)
                {
                    days = 30;
                }
                dlg.SelectedLabel = days - 1;
                dlg.DoModal(GetID);
                if (dlg.SelectedLabel < 0)
                {
                    return;
                }
                if (currentProgram.StartTime < DateTime.Now)
                {
                    currentProgram.KeepUntilDate = DateTime.Now.AddDays(dlg.SelectedLabel + 1);
                }
                else
                {
                    currentProgram.KeepUntilDate = currentProgram.StartTime.AddDays(dlg.SelectedLabel + 1);
                }
                break;

            case 1046:
                currentProgram.KeepUntil = (int)KeepMethodType.Always;
                break;
            }
            currentProgram.Persist();
        }
Esempio n. 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);
            }
        }
        private void OnVideoCodec()
        {
            ArrayList availableVideoFilters = FilterHelper.GetFilters(MediaType.Video, MediaSubTypeEx.MPEG2);

            while (availableVideoFilters.Contains("CyberLink MPEG Muxer"))
            {
                availableVideoFilters.Remove("CyberLink MPEG Muxer");
            }

            while (availableVideoFilters.Contains("Ulead MPEG Muxer"))
            {
                availableVideoFilters.Remove("Ulead MPEG Muxer");
            }

            while (availableVideoFilters.Contains("PDR MPEG Muxer"))
            {
                availableVideoFilters.Remove("PDR MPEG Muxer");
            }

            while (availableVideoFilters.Contains("Nero Mpeg2 Encoder"))
            {
                availableVideoFilters.Remove("Nero Mpeg2 Encoder");
            }

            availableVideoFilters.Sort();
            GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU);

            if (dlg == null)
            {
                OnVideo();
                return;
            }

            dlg.Reset();
            dlg.SetHeading(GUILocalizeStrings.Get(496)); //Menu
            int selected = 0;
            int count    = 0;

            foreach (string codec in availableVideoFilters)
            {
                dlg.Add(codec); //delete

                if (codec == _strVideoCodec)
                {
                    selected = count;
                }
                count++;
            }
            dlg.SelectedLabel = selected;

            dlg.DoModal(GetID);

            if (dlg.SelectedLabel < 0)
            {
                OnVideo();
                return;
            }

            _strVideoCodec = (string)availableVideoFilters[dlg.SelectedLabel];
            OnVideo();
        }
Esempio n. 8
0
        private void OnPlay(int type)
        {
            string strHowToPlay = string.Empty;
            string strType      = string.Empty;

            using (Settings xmlreader = new MPSettings())
            {
                if (type == 2135) // Audio
                {
                    strType = "autoplay_video";
                }
                if (type == 2134) // Video
                {
                    strType = "autoplay_audio";
                }
                if (type == 300006) // photo
                {
                    strType = "autoplay_photo";
                }
                strHowToPlay = xmlreader.GetValueAsString("general", strType, "Ask");
            }
            GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU);

            if (dlg == null)
            {
                return;
            }

            dlg.Reset();
            dlg.SetHeading(GUILocalizeStrings.Get(496)); //Options

            dlg.AddLocalizedString(208);                 // Play
            dlg.AddLocalizedString(300007);              // Do not play
            dlg.AddLocalizedString(300008);              // Ask what to do

            // Set options from config
            switch (strHowToPlay)
            {
            case "Yes":
                dlg.SelectedLabel = 0;
                break;

            case "No":
                dlg.SelectedLabel = 1;
                break;

            case "Ask":
                dlg.SelectedLabel = 2;
                break;

            default:
                dlg.SelectedLabel = 2;
                break;
            }
            // Show options
            dlg.DoModal(GetID);

            if (dlg.SelectedId == -1)
            {
                OnAutoPlay();
                return;
            }

            switch (dlg.SelectedId)
            {
            case 208: // Play
                strHowToPlay = "Yes";
                break;

            case 300007: // Do not play
                strHowToPlay = "No";
                break;

            case 300008: // Ask what to do
                strHowToPlay = "Ask";
                break;
            }

            using (Settings xmlwriter = new MPSettings())
            {
                xmlwriter.SetValue("general", strType, strHowToPlay);
            }

            OnAutoPlay();
        }
Esempio n. 9
0
        public static decimal PromptAniDBRating(string title)
        {
            GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);

            if (dlg == null)
            {
                return(0);
            }

            dlg.Reset();
            if (string.IsNullOrEmpty(title))
            {
                dlg.SetHeading("User Rating");
            }
            else
            {
                dlg.SetHeading("User Rating - " + title);
            }
            dlg.Add("      1");
            dlg.Add("      1.5");
            dlg.Add("      2");
            dlg.Add("      2.5");
            dlg.Add("      3");
            dlg.Add("      3.5");
            dlg.Add("      4");
            dlg.Add("      4.5");
            dlg.Add("      5");
            dlg.Add("      5.5");
            dlg.Add("      6");
            dlg.Add("      6.5");
            dlg.Add("      7");
            dlg.Add("      7.5");
            dlg.Add("      8");
            dlg.Add("      8.5");
            dlg.Add("      9");
            dlg.Add("      9.5");
            dlg.Add("      10");

            dlg.DoModal(GUIWindowManager.ActiveWindow);

            decimal selValue = 0;

            switch (dlg.SelectedId)
            {
            case 1: selValue = (decimal)1; break;

            case 2: selValue = (decimal)1.5; break;

            case 3: selValue = (decimal)2; break;

            case 4: selValue = (decimal)2.5; break;

            case 5: selValue = (decimal)3; break;

            case 6: selValue = (decimal)3.5; break;

            case 7: selValue = (decimal)4; break;

            case 8: selValue = (decimal)4.5; break;

            case 9: selValue = (decimal)5; break;

            case 10: selValue = (decimal)5.5; break;

            case 11: selValue = (decimal)6; break;

            case 12: selValue = (decimal)6.5; break;

            case 13: selValue = (decimal)7; break;

            case 14: selValue = (decimal)7.5; break;

            case 15: selValue = (decimal)8; break;

            case 16: selValue = (decimal)8.5; break;

            case 17: selValue = (decimal)9; break;

            case 18: selValue = (decimal)9.5; break;

            case 19: selValue = (decimal)10; break;
            }

            return(selValue);
        }
Esempio n. 10
0
        private void DisplayContextDialog()
        {
            if (ActiveListControl.SelectedListItem == null)
            {
                DisplayGlobalActionsMenu();
                return;
            }

            MovieMatch selectedFile = ActiveListControl.SelectedListItem == null ? null : ActiveListControl.SelectedListItem.AlbumInfoTag as MovieMatch;

            // create our dialog
            GUIDialogMenu matchDialog = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);

            if (matchDialog == null)
            {
                logger.Error("Could not create matches dialog.");
                return;
            }

            int maxid = 0;

            matchDialog.Reset();
            matchDialog.SetHeading(Translation.PossibleMatches);

            int selectId = -100;
            int playId   = -100;
            int ignoreId = -100;
            int globalId = -100;

            selectId = ++maxid;
            matchDialog.Add(Translation.SelectCorrectMovie + " ...");

            playId = ++maxid;
            matchDialog.Add(Translation.PlayMovie);

            ignoreId = ++maxid;
            matchDialog.Add(Translation.IgnoreMovie);

            globalId = ++maxid;
            matchDialog.Add(Translation.GlobalActions + " ...");

            // launch dialog and let user make choice
            matchDialog.DoModal(GUIWindowManager.ActiveWindow);

            // if the user canceled bail
            if (matchDialog.SelectedId == -1)
            {
                return;
            }

            // open selection dialog
            if (matchDialog.SelectedId == selectId)
            {
                bool success = DisplayMovieSelectionDialog();
                if (!success)
                {
                    DisplayContextDialog();
                }
                return;
            }

            // ignore file
            if (matchDialog.SelectedId == ignoreId)
            {
                MovingPicturesCore.Importer.Ignore(selectedFile);
            }

            // global actions dialog
            if (matchDialog.SelectedId == globalId)
            {
                bool success = DisplayGlobalActionsMenu();
                if (!success)
                {
                    DisplayContextDialog();
                }
                return;
            }

            if (matchDialog.SelectedId == playId)
            {
                if (movieStartIndicator != null)
                {
                    movieStartIndicator.Visible = true;
                    GUIWindowManager.Process();
                }

                // Play movie
                if (MovingPicturesCore.Importer.CommitedMatches.Contains(selectedFile))
                {
                    MovingPicturesCore.Player.Play(selectedFile.Selected.Movie);
                }
                else
                {
                    MovingPicturesCore.Player.playFile(selectedFile.LocalMedia[0].FullPath);
                }

                if (movieStartIndicator != null)
                {
                    movieStartIndicator.Visible = false;
                }
            }
        }
Esempio n. 11
0
        private bool DisplaySearchDialog(MovieMatch selectedFile)
        {
            GUIDialogMenu dialog = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);

            if (dialog == null)
            {
                logger.Error("Could not create search dialog.");
                return(false);
            }

            int maxid = 0;

            dialog.Reset();
            dialog.SetHeading(Translation.Search);

            int titleId = ++maxid;

            dialog.Add(string.Format("{0}: {1}", Translation.Title, selectedFile.Signature.Title));

            int yearId = ++maxid;

            dialog.Add(string.Format("{0}: {1}", Translation.Year, selectedFile.Signature.Year));

            int imdbId = ++maxid;

            dialog.Add(string.Format("{0}: {1}", Translation.ImdbId, selectedFile.Signature.ImdbId));

            dialog.DoModal(GUIWindowManager.ActiveWindow);

            // user picked nothing, go back to previous dialog
            if (dialog.SelectedId == -1)
            {
                return(false);
            }

            // build and display our virtual keyboard
            VirtualKeyboard keyboard = (VirtualKeyboard)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_VIRTUAL_KEYBOARD);

            keyboard.Reset();
            keyboard.IsSearchKeyboard = true;

            if (dialog.SelectedId == titleId)
            {
                keyboard.Text = selectedFile.Signature.Title;
            }
            if (dialog.SelectedId == yearId)
            {
                keyboard.Text = (selectedFile.Signature.Year == null) ? "" : selectedFile.Signature.Year.ToString();
            }
            if (dialog.SelectedId == imdbId)
            {
                keyboard.Text = (selectedFile.Signature.ImdbId == null) ? "" : selectedFile.Signature.ImdbId;
            }
            keyboard.DoModal(GUIWindowManager.ActiveWindow);

            // if the user escaped out redisplay the searchdialog
            if (!keyboard.IsConfirmed)
            {
                return(DisplaySearchDialog(selectedFile));
            }

            // user entered something so update the movie signature
            if (dialog.SelectedId == titleId)
            {
                selectedFile.Signature.Title = keyboard.Text;
            }
            if (dialog.SelectedId == yearId)
            {
                selectedFile.Signature.Year = Convert.ToInt32(keyboard.Text);
            }
            if (dialog.SelectedId == imdbId)
            {
                selectedFile.Signature.ImdbId = keyboard.Text;
            }
            MovingPicturesCore.Importer.Reprocess(selectedFile);

            return(true);
        }
Esempio n. 12
0
        protected override void OnClicked(int controlId, GUIControl control, global::MediaPortal.GUI.Library.Action.ActionType actionType)
        {
            base.OnClicked(controlId, control, actionType);

            if (control == _searchButton)
            {
                _selectedTitleIndex   = 0;
                _selectedProgramIndex = 0;

                if (_rules.Count > 0)
                {
                    GUIDialogYesNo dlgYesNo = (GUIDialogYesNo)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_YES_NO);
                    if (dlgYesNo != null)
                    {
                        dlgYesNo.SetHeading(Utility.GetLocalizedText(TextId.Attention));
                        dlgYesNo.SetLine(1, Utility.GetLocalizedText(TextId.ContinueWithPrevResults));
                        dlgYesNo.SetDefaultToYes(true);
                        dlgYesNo.DoModal(GetID);
                        if (!dlgYesNo.IsConfirmed)
                        {
                            _rules.Clear();
                            if (_viewsList != null && _viewsList.Count > 0)
                            {
                                _viewsList.Clear();
                            }
                        }
                    }
                }

                VirtualKeyboard keyboard = (VirtualKeyboard)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_VIRTUAL_KEYBOARD);
                if (keyboard != null)
                {
                    keyboard.Reset();
                    keyboard.IsSearchKeyboard = true;
                    keyboard.Text             = String.Empty;
                    keyboard.DoModal(GetID);
                    if (keyboard.IsConfirmed)
                    {
                        if (keyboard.Text == string.Empty)
                        {
                            GUIDialogOK dlgOk = (GUIDialogOK)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_OK);
                            if (dlgOk != null)
                            {
                                dlgOk.SetHeading(Utility.GetLocalizedText(TextId.Information));
                                dlgOk.SetLine(1, Utility.GetLocalizedText(TextId.NoValidSearchText));
                                dlgOk.DoModal(GetID);
                            }
                        }
                        else
                        {
                            switch (_currentSearchMethod)
                            {
                            case SearchInMethod.Title:
                                _rules.Add(ScheduleRuleType.TitleContains, keyboard.Text);
                                break;

                            case SearchInMethod.Description:
                                _rules.Add(ScheduleRuleType.DescriptionContains, keyboard.Text);
                                break;

                            case SearchInMethod.ProgramInfo:
                                _rules.Add(ScheduleRuleType.ProgramInfoContains, keyboard.Text);
                                break;

                            case SearchInMethod.Actor:
                                _rules.Add(ScheduleRuleType.WithActor, keyboard.Text);
                                break;

                            case SearchInMethod.DirectedBy:
                                _rules.Add(ScheduleRuleType.DirectedBy, keyboard.Text);
                                break;
                            }
                            ShowSearchResults(string.Empty);
                        }
                    }
                }
            }
            else if (control == _searchMethodButton)
            {
                GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU);
                if (dlg == null)
                {
                    return;
                }
                dlg.Reset();
                dlg.SetHeading(467);
                dlg.Add(Utility.GetLocalizedText(TextId.SearchOnTitle));
                dlg.Add(Utility.GetLocalizedText(TextId.SearchOnDescription));
                dlg.Add(Utility.GetLocalizedText(TextId.SearchOnProgramInfo));
                dlg.Add(Utility.GetLocalizedText(TextId.SearchOnActor));
                dlg.Add(Utility.GetLocalizedText(TextId.SearchOnDirectedBy));

                dlg.SelectedLabel = (int)_currentSearchMethod;
                // show dialog and wait for result
                dlg.DoModal(GetID);
                if (dlg.SelectedId == -1)
                {
                    return;
                }
                _currentSearchMethod = (SearchInMethod)(dlg.SelectedLabel);
                UpdateButtonStates();
            }
            else if (control == _selectChannelsButton)
            {
                List <ChannelGroup> groups         = new List <ChannelGroup>(PluginMain.Navigator.GetGroups(this._channelType));
                ChannelGroup        _selectedGroup = new ChannelGroup();

                if (groups.Count > 0)
                {
                    if (groups.Count > 1)
                    {
                        GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU);
                        if (dlg == null)
                        {
                            return;
                        }

                        dlg.Reset();
                        dlg.SetHeading(Utility.GetLocalizedText(TextId.SelectGroup));
                        foreach (ChannelGroup group in groups)
                        {
                            dlg.Add(group.GroupName);
                        }

                        // show dialog and wait for result
                        dlg.DoModal(GetID);
                        if (dlg.SelectedId == -1)
                        {
                            return;
                        }
                        _selectedGroup = groups[dlg.SelectedId - 1];
                    }
                    else
                    {
                        _selectedGroup = groups[0];
                    }

                    List <Channel> channels = new List <Channel>();
                    if (_channelArguments.Count > 0)
                    {
                        List <Channel> channels2 = new List <Channel>(SchedulerAgent.GetChannelsInGroup(_selectedGroup.ChannelGroupId, true));
                        foreach (Channel channel in channels2)
                        {
                            if (!_channelArguments.Contains(channel.ChannelId))
                            {
                                channels.Add(channel);
                            }
                        }
                    }
                    else
                    {
                        channels = new List <Channel>(SchedulerAgent.GetChannelsInGroup(_selectedGroup.ChannelGroupId, true));
                    }

                    if (channels.Count > 0)
                    {
                        GUIDialogMenu dlg2 = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU);
                        if (dlg2 == null)
                        {
                            return;
                        }

                        dlg2.Reset();
                        dlg2.SetHeading(GetChannelArgumentsString(true));
                        foreach (Channel channel in channels)
                        {
                            dlg2.Add(channel.DisplayName);
                        }

                        // show dialog and wait for result
                        dlg2.DoModal(GetID);
                        if (dlg2.SelectedId == -1)
                        {
                            return;
                        }
                        _channelArguments.Add(channels[dlg2.SelectedId - 1].ChannelId);
                        UpdateButtonStates();
                    }
                    else
                    {
                        GUIDialogOK dlgOk = (GUIDialogOK)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_OK);
                        if (dlgOk != null)
                        {
                            dlgOk.SetHeading(Utility.GetLocalizedText(TextId.Information));
                            dlgOk.SetLine(1, Utility.GetLocalizedText(TextId.NoMoreChannelsToAdd));
                            dlgOk.DoModal(GetID);
                        }
                    }
                }
            }
            else if (control == _selectCategoriesButton)
            {
                List <string> categories  = new List <string>();
                string[]      _categories = new string[0];
                _categories = GuideAgent.GetAllCategories();

                foreach (string categorie in _categories)
                {
                    if (!_categorieArguments.Contains(categorie))
                    {
                        categories.Add(categorie);
                    }
                }

                if (categories.Count > 0)
                {
                    GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU);
                    if (dlg == null)
                    {
                        return;
                    }

                    dlg.Reset();
                    dlg.SetHeading(GetCategorieArgumentString(true));
                    foreach (string categorie in categories)
                    {
                        dlg.Add(categorie);
                    }

                    // show dialog and wait for result
                    dlg.DoModal(GetID);
                    if (dlg.SelectedId == -1)
                    {
                        return;
                    }
                    _categorieArguments.Add(dlg.SelectedLabelText);
                    UpdateButtonStates();
                }
                else
                {
                    GUIDialogOK dlgOk = (GUIDialogOK)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_OK);
                    if (dlgOk != null)
                    {
                        dlgOk.SetHeading(Utility.GetLocalizedText(TextId.Information));
                        dlgOk.SetLine(1, Utility.GetLocalizedText(TextId.NoMoreCategoriesToAdd));
                        dlgOk.DoModal(GetID);
                    }
                }
            }
            else if (control == _clearButton)
            {
                OnClearRules(true);
                ShowSearchResults(string.Empty);
                UpdateButtonStates();
            }
            else if (control == _sortByButton)
            {
                if (_isInSubDirectory)
                {
                    GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU);
                    if (dlg == null)
                    {
                        return;
                    }
                    dlg.Reset();
                    dlg.SetHeading(495);         //Sort Options
                    dlg.AddLocalizedString(620); //channel
                    dlg.AddLocalizedString(621); //date
                    dlg.AddLocalizedString(268); //title/name

                    // set the focus to currently used sort method
                    dlg.SelectedLabel = (int)_currentSortMethod;

                    // show dialog and wait for result
                    dlg.DoModal(GetID);
                    if (dlg.SelectedId == -1)
                    {
                        return;
                    }
                    _currentSortMethod = (SortMethod)dlg.SelectedLabel;
                    OnSort();
                }
            }
            else if (control == _viewsList)
            {
                GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_ITEM_SELECTED, GetID, 0, control.GetID, 0, 0, null);
                OnMessage(msg);
                int iItem = (int)msg.Param1;
                if (actionType == Action.ActionType.ACTION_SELECT_ITEM)
                {
                    OnSelectItem(iItem);
                }
                if (actionType == Action.ActionType.ACTION_SHOW_INFO)
                {
                    OnShowContextMenu();
                }
            }
        }
Esempio n. 13
0
        protected override void OnClicked(int controlId, GUIControl control, Action.ActionType actionType)
        {
            if (control == btnSkin)
            {
                GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU);
                if (dlg == null)
                {
                    return;
                }
                dlg.Reset();
                dlg.SetHeading(166); // menu

                List <string> installedSkins = new List <string>();
                installedSkins = GetInstalledSkins();

                foreach (string skin in installedSkins)
                {
                    dlg.Add(skin);
                }
                dlg.SelectedLabel = btnSkin.SelectedItem;
                dlg.DoModal(GetID);
                if (dlg.SelectedId == -1)
                {
                    return;
                }
                if (String.Compare(dlg.SelectedLabelText, btnSkin.Label, true) != 0)
                {
                    btnSkin.Label = dlg.SelectedLabelText;
                    OnSkinChanged();
                }
                return;
            }
            if (control == btnLanguage)
            {
                GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU);
                if (dlg == null)
                {
                    return;
                }
                dlg.Reset();
                dlg.SetHeading(248); // menu
                string[] languages = GUILocalizeStrings.SupportedLanguages();
                foreach (string lang in languages)
                {
                    dlg.Add(lang);
                }
                string currentLanguage = btnLanguage.Label;
                dlg.SelectedLabel = 0;
                for (int i = 0; i < languages.Length; i++)
                {
                    if (languages[i].ToLower() == currentLanguage.ToLower())
                    {
                        dlg.SelectedLabel = i;
                        break;
                    }
                }
                dlg.DoModal(GetID);
                if (dlg.SelectedId == -1)
                {
                    return;
                }
                if (String.Compare(dlg.SelectedLabelText, btnLanguage.Label, true) != 0)
                {
                    btnLanguage.Label = dlg.SelectedLabelText;
                    OnLanguageChanged();
                }
                return;
            }
            base.OnClicked(controlId, control, actionType);
        }
Esempio n. 14
0
        private void OnShowContextMenu(int iItem, bool clicked)
        {
            m_iSelectedItem = iItem;
            GUIListItem item = GetItem(iItem);

            if (item == null)
            {
                return;
            }

            if (item.IsFolder && clicked)
            {
                bool noitems = false;
                if (item.Label == "..")
                {
                    if (selectedItem != null)
                    {
                        selectedItem = null;
                    }
                    LoadDirectory();
                    return;
                }
                if (selectedItem == null)
                {
                    IList <Schedule> seriesList = TVHome.Util.GetRecordingTimes(item.TVTag as Schedule);
                    if (seriesList.Count < 1)
                    {
                        noitems = true; // no items existing
                    }
                    else
                    {
                        selectedItem = item.TVTag as Schedule;
                    }
                }
                if (noitems == false)
                {
                    LoadDirectory();
                    return;
                }
            }

            bool showSeries = btnSeries.Selected;

            Schedule rec = item.TVTag as Schedule;

            if (rec == null)
            {
                return;
            }

            Log.Info("OnShowContextMenu: Rec = {0}", rec.ToString());
            GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU);

            if (dlg == null)
            {
                return;
            }

            dlg.Reset();
            dlg.SetHeading(rec.ProgramName);

            if (showSeries && item.IsFolder)
            {
                dlg.AddLocalizedString(982); //Cancel this show (618=delete)
                dlg.AddLocalizedString(888); //Episodes management
            }
            else if (rec.Series == false)
            {
                dlg.AddLocalizedString(618); //delete
            }
            else
            {
                dlg.AddLocalizedString(981); //Cancel this show
                dlg.AddLocalizedString(982); //Delete this entire recording
                dlg.AddLocalizedString(888); //Episodes management
            }
            VirtualCard card;
            TvServer    server = new TvServer();

            bool isRec = Schedule.IsScheduleRecording(rec.IdSchedule); //TVHome.IsRecordingSchedule(rec, null, out card);

            if (isRec)
            {
                dlg.AddLocalizedString(979); //Play recording from beginning
                dlg.AddLocalizedString(980); //Play recording from live point
            }

            //Schedule schedDB = Schedule.Retrieve(rec.IdSchedule);
            //if (schedDB.ScheduleType != (int)ScheduleRecordingType.Once)
            //{
            dlg.AddLocalizedString(1048); // settings
            //}

            dlg.DoModal(GetID);
            if (dlg.SelectedLabel == -1)
            {
                return;
            }

            bool isSchedRec = TvDatabase.Schedule.IsScheduleRecording(rec.IdSchedule);
            //TVHome.IsRecordingSchedule(rec, null, out card);

            string fileName = "";

            if (isSchedRec)
            {
                bool isCardRec = server.IsRecording(rec.ReferencedChannel().IdChannel, out card);
                if (isCardRec && card != null)
                {
                    fileName = card.RecordingFileName;
                }
            }
            Log.Info("recording fname:{0}", fileName);
            switch (dlg.SelectedId)
            {
            case 888: ////Episodes management
                TvPriorities.OnSetEpisodesToKeep(rec);
                break;

            case 1048: ////settings
                Schedule schedule = item.MusicTag as Schedule;
                if (schedule == null)
                {
                    schedule = item.TVTag as Schedule;
                }
                if (schedule != null)
                {
                    TVProgramInfo.CurrentRecording = schedule;
                    GUIWindowManager.ActivateWindow((int)Window.WINDOW_TV_PROGRAM_INFO);
                }
                return;

            case 882: ////Quality settings
                TvPriorities.OnSetQuality(rec);
                break;

            case 981: //Cancel this show
            {
                var layer = new TvBusinessLayer();
                // get the program that this episode is for
                var progs = layer.GetPrograms(rec.ReferencedChannel(), rec.StartTime, rec.EndTime);
                // pick up the schedule that is actually used for recording
                // see TVUtil.GetRecordingTimes where schedules are all spawend as one off types
                // and this is what rec is (ie. it does not actually exist in the database)
                var  realSchedule = Schedule.Retrieve(rec.IdParentSchedule) ?? rec;
                bool res          = TVUtil.DeleteRecAndSchedWithPrompt(realSchedule, progs[0]);
                if (res)
                {
                    LoadDirectory();
                }
            }
            break;

            case 982: //Delete series recording
                goto case 618;

            case 618: // delete entire recording
            {
                bool res = TVUtil.DeleteRecAndEntireSchedWithPrompt(rec, rec.StartTime);
                if (res)
                {
                    if (showSeries && !item.IsFolder)
                    {
                        OnShowContextMenu(0, true);
                        return;
                    }
                    else
                    {
                        LoadDirectory();
                    }
                }
            }
            break;

            case 979: // Play recording from beginning
            {
                Recording recDB = Recording.Retrieve(fileName);
                if (recDB != null)
                {
                    TVUtil.PlayRecording(recDB);
                }
            }
                return;

            case 980: // Play recording from live point
            {
                TVHome.ViewChannelAndCheck(rec.ReferencedChannel());
                if (g_Player.Playing)
                {
                    g_Player.ShowFullScreenWindow();
                }

                /*
                 * g_Player.Stop();
                 * if (System.IO.File.Exists(fileName))
                 * {
                 * g_Player.Play(fileName, g_Player.MediaType.Recording);
                 * g_Player.SeekAbsolute(g_Player.Duration);
                 * g_Player.ShowFullScreenWindow();
                 * return;
                 * }
                 * else
                 * {
                 * string url = server.GetRtspUrlForFile(fileName);
                 * Log.Info("recording url:{0}", url);
                 * if (url.Length > 0)
                 * {
                 *  g_Player.Play(url, g_Player.MediaType.Recording);
                 *
                 *  if (g_Player.Playing)
                 *  {
                 *    g_Player.SeekAbsolute(g_Player.Duration);
                 *    g_Player.SeekAbsolute(g_Player.Duration);
                 *    g_Player.ShowFullScreenWindow();
                 *    return;
                 *  }
                 * }
                 * }*/
            }
            break;
            }
            while (m_iSelectedItem >= GetItemCount() && m_iSelectedItem > 0)
            {
                m_iSelectedItem--;
            }
            GUIControl.SelectItemControl(GetID, listSchedules.GetID, m_iSelectedItem);
        }
Esempio n. 15
0
        private void OnKeep()
        {
            if (_upcomingProgram != null)
            {
                Schedule schedule = SchedulerAgent.GetScheduleById(_upcomingProgram.ScheduleId);
                if (schedule == null)
                {
                    return;
                }

                GUIDialogMenu dialog = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);
                if (dialog == null)
                {
                    return;
                }
                dialog.Reset();

                dialog.SetHeading(1042); // Keep until
                dialog.Add(Utility.GetLocalizedText(TextId.UntilSpaceNeeded));
                dialog.Add(Utility.GetLocalizedText(TextId.NumberOfDays));
                dialog.Add(Utility.GetLocalizedText(TextId.NumberOfEpisodes));
                dialog.Add(Utility.GetLocalizedText(TextId.NumberOfWatchedEpisodes));
                dialog.Add(Utility.GetLocalizedText(TextId.Forever));

                switch (schedule.KeepUntilMode)
                {
                case KeepUntilMode.UntilSpaceIsNeeded:
                    dialog.SelectedLabel = 0;
                    break;

                case KeepUntilMode.NumberOfDays:
                    dialog.SelectedLabel = 1;
                    break;

                case KeepUntilMode.NumberOfEpisodes:
                    dialog.SelectedLabel = 2;
                    break;

                case KeepUntilMode.NumberOfWatchedEpisodes:
                    dialog.SelectedLabel = 3;
                    break;

                case KeepUntilMode.Forever:
                    dialog.SelectedLabel = 4;
                    break;
                }

                dialog.DoModal(GetID);
                if (dialog.SelectedId == -1)
                {
                    return;
                }

                switch (dialog.SelectedLabel)
                {
                case 0:
                    schedule.KeepUntilMode = KeepUntilMode.UntilSpaceIsNeeded;
                    break;

                case 1:
                {
                    int?value = GetKeepValue(1045, KeepUntilMode.NumberOfDays, 3014, 3015,
                                             schedule.KeepUntilMode == KeepUntilMode.NumberOfDays ? schedule.KeepUntilValue : 7);
                    if (value.HasValue)
                    {
                        schedule.KeepUntilMode  = KeepUntilMode.NumberOfDays;
                        schedule.KeepUntilValue = value;
                    }
                }
                break;

                case 2:
                {
                    int?value = GetKeepValue(887, KeepUntilMode.NumberOfEpisodes, 682, 914,
                                             schedule.KeepUntilMode == KeepUntilMode.NumberOfEpisodes ? schedule.KeepUntilValue : 3);
                    if (value.HasValue)
                    {
                        schedule.KeepUntilMode  = KeepUntilMode.NumberOfEpisodes;
                        schedule.KeepUntilValue = value;
                    }
                }
                break;

                case 3:
                {
                    int?value = GetKeepValue(887, KeepUntilMode.NumberOfWatchedEpisodes, 682, 914,
                                             schedule.KeepUntilMode == KeepUntilMode.NumberOfWatchedEpisodes ? schedule.KeepUntilValue : 3);
                    if (value.HasValue)
                    {
                        schedule.KeepUntilMode  = KeepUntilMode.NumberOfWatchedEpisodes;
                        schedule.KeepUntilValue = value;
                    }
                }
                break;

                case 4:
                    schedule.KeepUntilMode = KeepUntilMode.Forever;
                    break;
                }

                if (schedule != null)
                {
                    SchedulerAgent.SaveSchedule(schedule);
                }
            }
        }
Esempio n. 16
0
        internal void MyContextMenu()
        {
            try
            {
                GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);
                if (dlg == null)
                {
                    return;
                }

                dlg.Reset();
                dlg.SetHeading(924);

                //Play Menu Item
                GUIListItem pItem = new GUIListItem();
                pItem.Label  = Translation.Play;
                pItem.ItemId = 1;
                dlg.Add(pItem);

                // Thumb Types
                pItem        = new GUIListItem();
                pItem.Label  = "[^] " + CurrentFacade.ThumbType;
                pItem.ItemId = 2;
                dlg.Add(pItem);

                // Update
                pItem        = new GUIListItem();
                pItem.Label  = Translation.Update;
                pItem.ItemId = 3;
                dlg.Add(pItem);

                //Show Dialog
                dlg.DoModal(Utils.ActiveWindow);

                if (dlg.SelectedLabel < 0)
                {
                    return;
                }

                switch (dlg.SelectedId)
                {
                case 1:
                {
                    PlayMusicAlbum(GUIWindowManager.GetWindow(Utils.ActiveWindow));
                    break;
                }

                case 2:
                {
                    GUIDialogMenu ldlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);
                    if (ldlg == null)
                    {
                        return;
                    }

                    ldlg.Reset();
                    ldlg.SetHeading(924);

                    // Artist Thumb
                    pItem        = new GUIListItem();
                    pItem.Label  = (CurrentFacade.ThumbType == LatestsFacadeThumbType.Artist ? "[X] " : string.Empty) + Translation.MvCThumbArtist;
                    pItem.ItemId = 1;
                    ldlg.Add(pItem);

                    // Album Thumb
                    pItem        = new GUIListItem();
                    pItem.Label  = (CurrentFacade.ThumbType == LatestsFacadeThumbType.Album ? "[X] " : string.Empty) + Translation.MvCThumbAlbum;
                    pItem.ItemId = 2;
                    ldlg.Add(pItem);

                    // Track Thumb
                    pItem        = new GUIListItem();
                    pItem.Label  = (CurrentFacade.ThumbType == LatestsFacadeThumbType.Track ? "[X] " : string.Empty) + Translation.MvCThumbTrack;
                    pItem.ItemId = 3;
                    ldlg.Add(pItem);

                    //Show Dialog
                    ldlg.DoModal(Utils.ActiveWindow);

                    if (ldlg.SelectedLabel < 0)
                    {
                        return;
                    }

                    if (ldlg.SelectedId == 1)
                    {
                        CurrentFacade.ThumbType = LatestsFacadeThumbType.Artist;
                    }
                    else if (ldlg.SelectedId == 2)
                    {
                        CurrentFacade.ThumbType = LatestsFacadeThumbType.Album;
                    }
                    else if (ldlg.SelectedId == 3)
                    {
                        CurrentFacade.ThumbType = LatestsFacadeThumbType.Track;
                    }
                    GetLatestMediaInfoThread();
                    break;
                }

                case 3:
                {
                    GetLatestMediaInfoThread();
                    break;
                }
                }
            }
            catch (Exception ex)
            {
                logger.Error("MyContextMenu: " + ex.ToString());
            }
        }
        internal void MyContextMenu()
        {
            try
            {
                GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);
                if (dlg == null)
                {
                    return;
                }

                dlg.Reset();
                dlg.SetHeading(924);

                //Play Menu Item
                GUIListItem pItem = new GUIListItem(Translation.Play);
                dlg.Add(pItem);
                pItem.ItemId = 1;

                //Add Watched/Unwatched Filter Menu Item
                if (!Utils.LatestTVRecordingsWatched)
                {
                    pItem = new GUIListItem(Translation.ShowUnwatchedRecordings);
                    dlg.Add(pItem);
                    pItem.ItemId = 2;
                }
                else
                {
                    pItem = new GUIListItem(Translation.ShowAllRecordings);
                    dlg.Add(pItem);
                    pItem.ItemId = 2;
                }

                //Show Dialog
                dlg.DoModal(Utils.ActiveWindow);

                if (dlg.SelectedLabel == -1)
                {
                    return;
                }

                switch (dlg.SelectedId)
                {
                case 1:
                {
                    // parent.CurrentFacade.Facade = Utils.GetLatestsFacade(parent.CurrentFacade.ControlID);
                    if (parent.CurrentFacade.Facade != null)
                    {
                        PlayRecording(parent.CurrentFacade.Facade.SelectedListItem.ItemId);
                    }
                    break;
                }

                case 2:
                {
                    Utils.LatestTVRecordingsWatched = !Utils.LatestTVRecordingsWatched;
                    GetTVRecordings();
                    break;
                }
                }
            }
            catch (Exception ex)
            {
                logger.Error("MyContextMenu: " + ex.ToString());
            }
        }
Esempio n. 18
0
        protected override void OnShowContextMenu()
        {
            GUIListItem item      = lstDetails.SelectedListItem;
            BaseScore   itemScore = item.TVTag as BaseScore;

            int menuIndice = 1;

            #region Create Menu
            GUIDialogMenu menu = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);
            menu.Reset();
            menu.SetHeading(m_center.Setup.Name);

            // configure
            menu.Add(LocalizationManager.GetString(Labels.Configuration));
            int menuConfigure = menuIndice++;

            // enable/disable live
            if (m_liveEnabled)
            {
                menu.Add(LocalizationManager.GetString(Labels.StopLive));
            }
            else
            {
                menu.Add(LocalizationManager.GetString(Labels.StartLive));
            }
            int menuLive = menuIndice++;

            // clear all live
            int menuClearLive = 0;
            if (!m_liveEnabled)
            {
                menu.Add(LocalizationManager.GetString(Labels.ClearLive));
                menuClearLive = menuIndice++;
            }

            int menuDelete  = 0;
            int menuSetHome = 0;
            int menuSetLive = 0;
            if (item.Label != "..")
            {
                // disable
                menu.Add(LocalizationManager.GetString(Labels.DisableItem, item.Label));
                menuDelete = menuIndice++;

                // set home
                if (!itemScore.IsContainer())
                {
                    menu.Add(LocalizationManager.GetString(Labels.SetAsHome));
                    menuSetHome = menuIndice++;
                }

                if (!m_liveEnabled && itemScore.CanLive())
                {
                    // set live
                    menu.Add(LocalizationManager.GetString(item.PinImage == m_livePinImage ? Labels.DisableLive : Labels.ActivateLive, item.Label));
                    menuSetLive = menuIndice++;
                }
            }

            #endregion

            // show the menu
            menu.DoModal(GetID);

            #region process user action
            if (menu.SelectedId == menuLive)
            {
                SetLiveSettings();
            }
            else if (menu.SelectedId == menuClearLive)
            {
                ClearLiveSettings();
            }
            else if (menu.SelectedId == menuConfigure)
            {
                ShowConfigurationMenu();
            }
            else if (menu.SelectedId == menuDelete)
            {
                GUIDialogYesNo dlg     = (GUIDialogYesNo)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_YES_NO);
                string         disable = LocalizationManager.GetString(Labels.DisableItem, item.Label);
                dlg.SetHeading(m_center.Setup.Name);
                dlg.SetLine(1, LocalizationManager.GetString(Labels.DisableItem, item.Label) + " ?");
                dlg.DoModal(GetID);

                if (dlg.IsConfirmed)
                {
                    m_center.DisableScore(itemScore);
                    SaveSettings();
                }
            }
            else if (menu.SelectedId == menuSetHome)
            {
                m_center.SetHomeScore(itemScore);
                SaveSettings();
            }
            else if (menu.SelectedId == menuSetLive)
            {
                bool on = item.PinImage == m_livePinImage;
                m_center.SetLiveScore(itemScore, !on);
                string pin = "";
                if (!on)
                {
                    pin = m_livePinImage;
                }
                else if (itemScore.CanLive())
                {
                    pin = m_livePinImageDisabled;
                }

                item.PinImage = pin;
                SaveSettings();
                SetLiveStatus();
            }
            #endregion

            base.OnShowContextMenu();
        }
        private void OnVideo()
        {
            GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU);

            if (dlg != null)
            {
                dlg.Reset();
                dlg.SetHeading(GUILocalizeStrings.Get(496)); //Menu

                if (!_autoDecoderSettings)
                {
                    dlg.AddLocalizedString(6000);   // MPEG2
                    dlg.AddLocalizedString(6036);   // H264
                    dlg.AddLocalizedString(300212); // VC-1
                    dlg.AddLocalizedString(300213); // VC-1i
                    dlg.AddLocalizedString(300214); // DivX/Xvid
                    if (_ForceSourceSplitter)
                    {
                        dlg.AddLocalizedString(300215); // Splitter
                        if ((_strSplitterFilter == "File Source (Async.)" ||
                             _strSplitterFilter == "File Source (URL)"))
                        {
                            dlg.AddLocalizedString(300216); // FileSplitter
                        }
                    }
                }
                dlg.AddLocalizedString(6004); // Aspect Ratio
                dlg.AddLocalizedString(1029); // Subtitle

                if (_selectedOption != -1)
                {
                    dlg.SelectedLabel = _selectedOption;
                }

                dlg.DoModal(GetID);

                if (dlg.SelectedId == -1)
                {
                    return;
                }

                _selectedOption = dlg.SelectedLabel;

                switch (dlg.SelectedId)
                {
                case 6000:
                    OnVideoCodec();
                    break;

                case 6036:
                    OnH264VideoCodec();
                    break;

                case 6004:
                    OnAspectRatio();
                    break;

                case 1029:
                    OnSubtitle();
                    break;

                case 300212:
                    OnVC1();
                    break;

                case 300213:
                    OnVC1i();
                    break;

                case 300214:
                    OnDivX();
                    break;

                case 300215:
                    OnSplitter();
                    break;

                case 300216:
                    OnSplitterFilesync();
                    break;
                }
            }
        }
Esempio n. 20
0
        private void ShowConfigurationMenu()
        {
            GUIDialogMenu menu = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);

            menu.Reset();
            menu.SetHeading(LocalizationManager.GetString(Labels.Configuration));

            int menuIndice = 1;

            // synchro
            menu.Add(LocalizationManager.GetString(Labels.SynchroOnline));
            int menuSyncho = menuIndice++;

            // clear cache
            menu.Add(LocalizationManager.GetString(Labels.ClearCache));
            int menuClearCache = menuIndice++;

            // clear home
            menu.Add(LocalizationManager.GetString(Labels.ClearHome));
            int menuClearHome = menuIndice++;

            // auto mode
            if (m_autoSize)
            {
                menu.Add(LocalizationManager.GetString(Labels.UnuseAutoMode));
            }
            else
            {
                menu.Add(LocalizationManager.GetString(Labels.UseAutoMode));
            }
            int menuAutoMode = menuIndice++;

            // auto wrap
            if (m_autoWrap)
            {
                menu.Add(LocalizationManager.GetString(Labels.UnuseAutoWrap));
            }
            else
            {
                menu.Add(LocalizationManager.GetString(Labels.UseAutoWrap));
            }
            int menuAutoWrap = menuIndice++;

            // auto refresh
            if (m_center.Setup.AutoRefresh.enabled)
            {
                menu.Add(LocalizationManager.GetString(Labels.DisableAutoRefresh));
            }
            else
            {
                menu.Add(LocalizationManager.GetString(Labels.EnableAutoRefresh));
            }
            int menuAutoRefresh = menuIndice++;

            menu.DoModal(GetID);

            if (menu.SelectedId == menuClearCache)
            {
                ScoreFactory.Instance.ClearCache();
            }
            else if (menu.SelectedId == menuAutoMode)
            {
                m_autoSize = !m_autoSize;
                lock (m_lock)
                {
                    ClearGrid();
                    CreateGrid(m_lines, m_currentScore, 0, 0);
                }
            }
            else if (menu.SelectedId == menuAutoWrap)
            {
                m_autoWrap = !m_autoWrap;
                lock (m_lock)
                {
                    ClearGrid();
                    CreateGrid(m_lines, m_currentScore, 0, 0);
                }
            }
            else if (menu.SelectedId == menuClearHome)
            {
                m_center.SetHomeScore(null);
                SaveSettings();
            }
            else if (menu.SelectedId == menuSyncho)
            {
                System.Threading.ThreadPool.QueueUserWorkItem(delegate(object state)
                {
                    try
                    {
                        UpdateSettings(true, true);
                    }
                    catch (Exception ex)
                    {
                        Tools.LogError("Error occured while executing the Online Update: ", ex);
                    }
                    finally
                    {
                        GUIWaitCursor.Hide();
                    }
                });
            }
            else if (menu.SelectedId == menuAutoRefresh)
            {
                m_center.Setup.AutoRefresh.enabled = !m_center.Setup.AutoRefresh.enabled;
                SaveSettings();
            }

            base.OnShowContextMenu();
        }
Esempio n. 21
0
        protected override void OnShowContextMenu()
        {
            GUIListItem currentitem = m_Facade.SelectedListItem;

            if (currentitem == null)
            {
                return;
            }

            if (currentitem.TVTag.GetType() == typeof(VM_AnimeEpisode_User))
            {
                VM_AnimeEpisode_User ep = currentitem.TVTag as VM_AnimeEpisode_User;
                if (ep != null)
                {
                    GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU);
                    if (dlg == null)
                    {
                        return;
                    }

                    dlg.Reset();
                    dlg.SetHeading(ep.EpisodeNumberAndName);
                    dlg.Add("Mark as Watched");
                    dlg.Add("Play Previous Episode");
                    dlg.Add("Go To Episode List");
                    dlg.Add("View Series Info");

                    dlg.DoModal(GUIWindowManager.ActiveWindow);

                    switch (dlg.SelectedLabelText)
                    {
                    case "Mark as Watched":
                        ep.ToggleWatchedStatus(true);
                        LoadData();
                        break;

                    case "Play Previous Episode":
                        if (ep.AnimeSeries == null)
                        {
                            return;
                        }
                        VM_AnimeEpisode_User epPrev = (VM_AnimeEpisode_User)VM_ShokoServer.Instance.ShokoServices.GetPreviousEpisodeForUnwatched(ep.AnimeSeries.AnimeSeriesID,
                                                                                                                                                 VM_ShokoServer.Instance.CurrentUser.JMMUserID);

                        if (epPrev == null)
                        {
                            Utils.DialogMsg("Error", "Previous episode not found");
                            return;
                        }
                        MainWindow.vidHandler.ResumeOrPlay(epPrev);
                        break;

                    case "Go To Episode List":
                        if (ep.AnimeSeries == null)
                        {
                            return;
                        }

                        MainWindow.Breadcrumbs = new List <History>
                        {
                            new History {
                                Selected = GroupFilterHelper.AllGroupsFilter
                            }
                        };

                        // find the group for this series
                        VM_AnimeGroup_User grp = ShokoServerHelper.GetGroup(ep.AnimeSeries.AnimeGroupID);
                        if (grp == null)
                        {
                            BaseConfig.MyAnimeLog.Write("Group not found");
                            return;
                        }
                        MainWindow.ContinueWatching_CurrentSeries = ep.AnimeSeries;

                        MainWindow.Breadcrumbs.Add(new History {
                            Listing = GroupFilterHelper.AllGroupsFilter, Selected = grp
                        });
                        MainWindow.Breadcrumbs.Add(new History {
                            Listing = grp, Selected = MainWindow.ContinueWatching_CurrentSeries
                        });
                        bool foundEpType = false;
                        if (MainWindow.ContinueWatching_CurrentSeries.EpisodeTypesToDisplay.Count == 1)
                        {
                            MainWindow.Breadcrumbs.Add(new History {
                                Listing = MainWindow.ContinueWatching_CurrentSeries, Selected = null
                            });
                        }
                        else
                        {
                            foreach (VM_AnimeEpisodeType anEpType in MainWindow.ContinueWatching_CurrentSeries.EpisodeTypesToDisplay)
                            {
                                if (anEpType.EpisodeType == enEpisodeType.Episode)
                                {
                                    MainWindow.Breadcrumbs.Add(new History {
                                        Listing = MainWindow.ContinueWatching_CurrentSeries, Selected = anEpType
                                    });
                                    MainWindow.Breadcrumbs.Add(new History {
                                        Listing = anEpType, Selected = null
                                    });
                                    foundEpType = true;
                                    break;
                                }
                            }

                            if (!foundEpType)
                            {
                                return;
                            }
                        }
                        GUIWindowManager.CloseCurrentWindow();
                        GUIWindowManager.ActivateWindow(Constants.WindowIDs.MAIN, false);
                        return;

                    case "View Series Info":

                        if (ep.AnimeSeries == null)
                        {
                            return;
                        }
                        MainWindow.GlobalSeriesID = ep.AnimeSeries.AnimeSeriesID;
                        GUIWindowManager.ActivateWindow(Constants.WindowIDs.ANIMEINFO, false);

                        break;
                    }
                }
            }
        }
Esempio n. 22
0
        private void OnClick(int iItem)
        {
            m_iSelectedItem = GetSelectedItemNo();
            GUIListItem item = GetItem(iItem);

            if (item == null)
            {
                return;
            }
            if (item.IsFolder)
            {
                if (item.Label == "..")
                {
                    if (selectedItem != null)
                    {
                        selectedItem = null;
                    }
                    LoadDirectory();
                    return;
                }
                if (selectedItem == null)
                {
                    selectedItem = item;
                }
                LoadDirectory();
                return;
            }

            Schedule schedule = item.TVTag as Schedule;

            if (schedule == null)
            {
                return;
            }

            if (schedule.ScheduleType == (int)ScheduleRecordingType.Once)
            {
                GUIDialogYesNo dlgYesNo = (GUIDialogYesNo)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_YES_NO);
                if (null != dlgYesNo)
                {
                    dlgYesNo.SetHeading(GUILocalizeStrings.Get(653)); //Delete this recording?
                    dlgYesNo.SetLine(1, schedule.ReferencedChannel().DisplayName);
                    dlgYesNo.SetLine(2, schedule.ProgramName);
                    dlgYesNo.SetLine(3, GUILocalizeStrings.Get(732)); //are you sure
                    dlgYesNo.DoModal(GUIWindowManager.ActiveWindow);

                    if (dlgYesNo.IsConfirmed)
                    {
                        if (schedule.ScheduleType == (int)ScheduleRecordingType.Once)
                        {
                            schedule.Delete();
                            selectedItem = null;
                        }
                    }
                }
            }
            else // advanced recording
            {
                GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU);
                if (dlg != null)
                {
                    dlg.Reset();
                    dlg.SetHeading(schedule.ProgramName);
                    dlg.AddLocalizedString(981); //Delete this recording
                    dlg.AddLocalizedString(982); //Delete series recording
                    dlg.DoModal(GetID);
                    if (dlg.SelectedLabel == -1)
                    {
                        return;
                    }
                    switch (dlg.SelectedId)
                    {
                    case 981: //delete specific series
                        CanceledSchedule canceledSchedule = new CanceledSchedule(schedule.IdSchedule, schedule.IdChannel, schedule.StartTime);
                        canceledSchedule.Persist();
                        selectedItem = null;
                        TvServer server = new TvServer();
                        server.OnNewSchedule();
                        break;

                    case 982: //Delete entire recording
                        schedule.Delete();
                        selectedItem = null;
                        break;
                    }
                }
            }
            LoadDirectory();
        }
Esempio n. 23
0
        public override void OnAction(Action action)
        {
            if (action.wID == Action.ActionType.ACTION_SELECT_ITEM || action.wID == Action.ActionType.ACTION_MOUSE_CLICK)
            {
                int controlId = GetFocusControlId();
                if (controlId >= 1000 && controlId <= 9008)
                {
                    // Show dialog
                    CellControl cntlFoc = (CellControl)GetControl(controlId);
                    int         row     = (controlId / 1000) - 1;
                    int         column  = controlId % 1000;

                    if (cntlFoc.editable)
                    {
                        GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU);
                        if (dlg != null)
                        {
                            dlg.Reset();
                            dlg.SetHeading(GUILocalizeStrings.Get(19116)); // Cell value

                            for (int index = 1; index < 10; index++)
                            {
                                dlg.Add("");
                            }
                            dlg.Add(GUILocalizeStrings.Get(19117)); // Clear cell
                            dlg.SelectedLabel = cntlFoc.CellValue - 1;
                            dlg.DoModal(GetWindowId());
                            if (dlg.SelectedLabel < 0)
                            {
                                return;
                            }
                            else
                            {
                                if (dlg.SelectedId == 10)
                                {
                                    cntlFoc.CellValue       = 0;
                                    grid.cells[row, column] = 0;
                                }
                                else
                                {
                                    if (!_Settings.Block || cntlFoc.SolutionValue == dlg.SelectedId)
                                    {
                                        cntlFoc.CellValue       = dlg.SelectedId;
                                        grid.cells[row, column] = dlg.SelectedId;

                                        if (this.GridIsComplete())
                                        {
                                            this.Result();
                                        }
                                    }
                                }
                            }
                        }
                        CheckCandidates();
                    }
                }
            }
            else if (action.wID == Action.ActionType.ACTION_KEY_PRESSED ||
                     (action.wID >= Action.ActionType.REMOTE_0 && action.wID <= Action.ActionType.REMOTE_9))
            {
                int controlId = GetFocusControlId();
                if (controlId >= 1000 && controlId <= 9008)
                {
                    CellControl cntlFoc = (CellControl)GetControl(controlId);
                    int         row     = (controlId / 1000) - 1;
                    int         column  = controlId % 1000;

                    if (cntlFoc != null)
                    {
                        if (action.wID == Action.ActionType.ACTION_KEY_PRESSED)
                        {
                            if (action.m_key.KeyChar == 8)
                            {
                                cntlFoc.CellValue       = 0;
                                grid.cells[row, column] = 0;
                            }
                            else if (action.m_key.KeyChar == 35) // #
                            {
                                _nextNumberIsToggle = true;
                            }
                            else if (action.m_key.KeyChar == 42) // *
                            {
                                _nextNumberIsFilter = true;
                            }
                        }
                        else if (action.wID >= Action.ActionType.REMOTE_0 && action.wID <= Action.ActionType.REMOTE_9)
                        {
                            int value = (action.wID - Action.ActionType.REMOTE_0);

                            if (!_nextNumberIsToggle && !_nextNumberIsFilter)
                            {
                                if (value == 0 || !_Settings.Block || cntlFoc.SolutionValue == value)
                                {
                                    cntlFoc.CellValue       = value;
                                    grid.cells[row, column] = value;

                                    if (this.GridIsComplete())
                                    {
                                        this.Result();
                                    }
                                }
                            }
                            else if (_nextNumberIsToggle)
                            {
                                if (value > 0)
                                {
                                    if (cntlFoc.IsCandidate(value))
                                    {
                                        cntlFoc.RemoveCandidate(value);
                                    }
                                    else
                                    {
                                        cntlFoc.SetCandidate(value);
                                    }
                                }
                                _nextNumberIsToggle = false;
                            }
                            else if (_nextNumberIsFilter)
                            {
                                _Settings.Filter         = value;
                                _Settings.ShowCandidates = true;
                                _nextNumberIsFilter      = false;
                            }
                        }
                        CheckCandidates();
                    }
                }
            }
            else if (action.wID == Action.ActionType.ACTION_PREVIOUS_MENU)
            {
                StopTimer();
            }
            else if (action.wID == Action.ActionType.ACTION_CONTEXT_MENU)
            {
                ShowContextMenu();
            }
            else if (action.wID == Action.ActionType.ACTION_PREVIOUS_MENU)
            {
                StopTimer();
            }
            base.OnAction(action);
        }
        public static void OnSetQuality(Schedule rec)
        {
            GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU);

            if (dlg != null)
            {
                dlg.Reset();
                dlg.SetHeading(882);

                dlg.ShowQuickNumbers = true;
                dlg.AddLocalizedString(968);
                dlg.AddLocalizedString(965);
                dlg.AddLocalizedString(966);
                dlg.AddLocalizedString(967);
                VIDEOENCODER_BITRATE_MODE _newBitRate = rec.BitRateMode;
                switch (_newBitRate)
                {
                case VIDEOENCODER_BITRATE_MODE.NotSet:
                    dlg.SelectedLabel = 0;
                    break;

                case VIDEOENCODER_BITRATE_MODE.ConstantBitRate:
                    dlg.SelectedLabel = 1;
                    break;

                case VIDEOENCODER_BITRATE_MODE.VariableBitRateAverage:
                    dlg.SelectedLabel = 2;
                    break;

                case VIDEOENCODER_BITRATE_MODE.VariableBitRatePeak:
                    dlg.SelectedLabel = 3;
                    break;
                }

                dlg.DoModal(GUIWindowManager.ActiveWindow);

                if (dlg.SelectedLabel == -1)
                {
                    return;
                }
                switch (dlg.SelectedLabel)
                {
                case 0: // Not Set
                    _newBitRate = VIDEOENCODER_BITRATE_MODE.NotSet;
                    break;

                case 1: // CBR
                    _newBitRate = VIDEOENCODER_BITRATE_MODE.ConstantBitRate;
                    break;

                case 2: // VBR
                    _newBitRate = VIDEOENCODER_BITRATE_MODE.VariableBitRateAverage;
                    break;

                case 3: // VBR Peak
                    _newBitRate = VIDEOENCODER_BITRATE_MODE.VariableBitRatePeak;
                    break;
                }

                rec.BitRateMode = _newBitRate;
                rec.Persist();

                dlg.Reset();
                dlg.SetHeading(882);

                dlg.ShowQuickNumbers = true;
                dlg.AddLocalizedString(968);
                dlg.AddLocalizedString(886); //Default
                dlg.AddLocalizedString(993); // Custom
                dlg.AddLocalizedString(893); //Portable
                dlg.AddLocalizedString(883); //Low
                dlg.AddLocalizedString(884); //Medium
                dlg.AddLocalizedString(885); //High
                QualityType _newQuality = rec.QualityType;
                switch (_newQuality)
                {
                case QualityType.NotSet:
                    dlg.SelectedLabel = 0;
                    break;

                case QualityType.Default:
                    dlg.SelectedLabel = 1;
                    break;

                case QualityType.Custom:
                    dlg.SelectedLabel = 2;
                    break;

                case QualityType.Portable:
                    dlg.SelectedLabel = 3;
                    break;

                case QualityType.Low:
                    dlg.SelectedLabel = 4;
                    break;

                case QualityType.Medium:
                    dlg.SelectedLabel = 5;
                    break;

                case QualityType.High:
                    dlg.SelectedLabel = 6;
                    break;
                }

                dlg.DoModal(GUIWindowManager.ActiveWindow);

                if (dlg.SelectedLabel == -1)
                {
                    return;
                }
                switch (dlg.SelectedLabel)
                {
                case 0: // Not Set
                    _newQuality = QualityType.NotSet;
                    break;

                case 1: // Default
                    _newQuality = QualityType.Default;
                    break;

                case 2: // Custom
                    _newQuality = QualityType.Custom;
                    break;

                case 3: // Protable
                    _newQuality = QualityType.Portable;
                    break;

                case 4: // Low
                    _newQuality = QualityType.Low;
                    break;

                case 5: // Medium
                    _newQuality = QualityType.Medium;
                    break;

                case 6: // High
                    _newQuality = QualityType.High;
                    break;
                }

                rec.QualityType = _newQuality;
                rec.Persist();
            }
            TvServer server = new TvServer();

            server.OnNewSchedule();
        }
        internal void MyContextMenu()
        {
            try
            {
                GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);
                if (dlg == null)
                {
                    return;
                }

                dlg.Reset();
                dlg.SetHeading(924);

                //Add Details Menu Item
                //Play Menu Item
                GUIListItem pItem = new GUIListItem(Translation.Play);
                dlg.Add(pItem);
                pItem.ItemId = 1;

                pItem = new GUIListItem(Translation.MovieDetails);
                dlg.Add(pItem);
                pItem.ItemId = 2;

                //Add Watched/Unwatched Filter Menu Item
                if (CurrentFacade.UnWatched)
                {
                    pItem = new GUIListItem(Translation.ShowUnwatchedMovies);
                    dlg.Add(pItem);
                    pItem.ItemId = 3;
                }
                else
                {
                    pItem = new GUIListItem(Translation.ShowAllMovies);
                    dlg.Add(pItem);
                    pItem.ItemId = 3;
                }

                //Add Latests/Watched/Rated Menu Item
                pItem = new GUIListItem("[^] " + CurrentFacade.Title);
                dlg.Add(pItem);
                pItem.ItemId = 4;

                pItem        = new GUIListItem();
                pItem.Label  = Translation.Update;
                pItem.ItemId = 5;
                dlg.Add(pItem);

                //Show Dialog
                dlg.DoModal(Utils.ActiveWindow);

                if (dlg.SelectedLabel == -1)
                {
                    return;
                }

                // CurrentFacade.Facade = Utils.GetLatestsFacade(CurrentFacade.ControlID);
                switch (dlg.SelectedId)
                {
                case 1:
                {
                    PlayMovingPicture(GUIWindowManager.GetWindow(Utils.ActiveWindow));
                    break;
                }

                case 2:
                {
                    ShowInfo();
                    break;
                }

                case 3:
                {
                    CurrentFacade.UnWatched = !CurrentFacade.UnWatched;
                    MovingPictureUpdateLatest();
                    break;
                }

                case 4:
                {
                    IDialogbox ldlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);
                    if (ldlg == null)
                    {
                        return;
                    }

                    ldlg.Reset();
                    ldlg.SetHeading(924);

                    //Add Types Menu Items
                    pItem = new GUIListItem((CurrentFacade.Type == LatestsFacadeType.Latests ? "[x] " : string.Empty) + Translation.LabelLatestAdded);
                    ldlg.Add(pItem);
                    pItem.ItemId = 1;

                    pItem = new GUIListItem((CurrentFacade.Type == LatestsFacadeType.Watched ? "[x] " : string.Empty) + Translation.LabelLatestWatched);
                    ldlg.Add(pItem);
                    pItem.ItemId = 2;

                    pItem = new GUIListItem((CurrentFacade.Type == LatestsFacadeType.Rated ? "[x] " : string.Empty) + Translation.LabelHighestRated);
                    ldlg.Add(pItem);
                    pItem.ItemId = 3;

                    //Show Dialog
                    ldlg.DoModal(Utils.ActiveWindow);

                    if (ldlg.SelectedLabel == -1)
                    {
                        return;
                    }

                    switch (ldlg.SelectedId - 1)
                    {
                    case 0:
                        CurrentFacade.Type = LatestsFacadeType.Latests;
                        break;

                    case 1:
                        CurrentFacade.Type = LatestsFacadeType.Watched;
                        break;

                    case 2:
                        CurrentFacade.Type = LatestsFacadeType.Rated;
                        break;
                    }
                    MovingPictureUpdateLatest();
                    break;
                }

                case 5:
                {
                    MovingPictureUpdateLatest();
                    break;
                }
                }
            }
            catch (Exception ex)
            {
                logger.Error("MyContextMenu: " + ex.ToString());
            }
        }
        private void OnClick(int iItem)
        {
            m_iSelectedItem = GetSelectedItemNo();
            GUIListItem item = GetItem(iItem);

            if (item == null)
            {
                return;
            }
            Schedule rec = (Schedule)item.TVTag;

            GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU);

            if (dlg == null)
            {
                return;
            }

            dlg.Reset();
            dlg.SetHeading(rec.ProgramName);

            if (rec.Series == false)
            {
                dlg.AddLocalizedString(618); //delete
            }
            else
            {
                dlg.AddLocalizedString(981); //Delete this recording
                dlg.AddLocalizedString(982); //Delete series recording
                dlg.AddLocalizedString(888); //Episodes management
            }
            VirtualCard card;
            TvServer    server = new TvServer();

            if (server.IsRecordingSchedule(rec.IdSchedule, out card))
            {
                dlg.AddLocalizedString(979); //Play recording from beginning
                dlg.AddLocalizedString(980); //Play recording from live point
            }
            else
            {
                IList <TuningDetail> details = Channel.Retrieve(rec.IdChannel).ReferringTuningDetail();
                foreach (TuningDetail detail in details)
                {
                    if (detail.ChannelType == 0)
                    {
                        dlg.AddLocalizedString(882); //Quality settings
                        break;
                    }
                }
            }

            dlg.DoModal(GetID);
            if (dlg.SelectedLabel == -1)
            {
                return;
            }
            switch (dlg.SelectedId)
            {
            case 888: ////Episodes management
                OnSetEpisodesToKeep(rec);
                break;

            case 882:
                OnSetQuality(rec);
                break;

            case 981: //Delete this recording only
            {
                if (server.IsRecordingSchedule(rec.IdSchedule, out card))
                {
                    GUIDialogYesNo dlgYesNo = (GUIDialogYesNo)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_YES_NO);
                    if (null != dlgYesNo)
                    {
                        dlgYesNo.SetHeading(GUILocalizeStrings.Get(653)); //Delete this recording?
                        dlgYesNo.SetLine(1, GUILocalizeStrings.Get(730)); //This schedule is recording. If you delete
                        dlgYesNo.SetLine(2, GUILocalizeStrings.Get(731)); //the schedule then the recording is stopped.
                        dlgYesNo.SetLine(3, GUILocalizeStrings.Get(732)); //are you sure
                        dlgYesNo.DoModal(GUIWindowManager.ActiveWindow);

                        if (dlgYesNo.IsConfirmed)
                        {
                            server.StopRecordingSchedule(rec.IdSchedule);
                            CanceledSchedule schedule = new CanceledSchedule(rec.IdSchedule, rec.IdChannel, rec.StartTime);
                            rec.Persist();
                            server.OnNewSchedule();
                        }
                    }
                }
                else
                {
                    server.StopRecordingSchedule(rec.IdSchedule);
                    CanceledSchedule schedule = new CanceledSchedule(rec.IdSchedule, rec.IdChannel, rec.StartTime);
                    rec.Persist();
                    server.OnNewSchedule();
                }
                LoadDirectory();
            }
            break;

            case 982: //Delete series recording
                goto case 618;

            case 618: // delete entire recording
            {
                if (server.IsRecordingSchedule(rec.IdSchedule, out card))
                {
                    GUIDialogYesNo dlgYesNo = (GUIDialogYesNo)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_YES_NO);
                    if (null != dlgYesNo)
                    {
                        dlgYesNo.SetHeading(GUILocalizeStrings.Get(653)); //Delete this recording?
                        dlgYesNo.SetLine(1, GUILocalizeStrings.Get(730)); //This schedule is recording. If you delete
                        dlgYesNo.SetLine(2, GUILocalizeStrings.Get(731)); //the schedule then the recording is stopped.
                        dlgYesNo.SetLine(3, GUILocalizeStrings.Get(732)); //are you sure
                        dlgYesNo.DoModal(GUIWindowManager.ActiveWindow);

                        if (dlgYesNo.IsConfirmed)
                        {
                            server.StopRecordingSchedule(rec.IdSchedule);
                            rec.Delete();
                            server.OnNewSchedule();
                        }
                    }
                }
                else
                {
                    rec.Delete();
                    server.OnNewSchedule();
                }
                LoadDirectory();
            }
            break;

            case 979: // Play recording from beginning
                if (g_Player.Playing && g_Player.IsTVRecording)
                {
                    g_Player.Stop(true);
                }
                //TVHome.IsTVOn = true;
                TVHome.ViewChannel(rec.ReferencedChannel());
                g_Player.SeekAbsolute(0);
                if (TVHome.Card.IsTimeShifting)
                {
                    g_Player.ShowFullScreenWindow();
                    return;
                }
                break;

            case 980: // Play recording from live point
                //TVHome.IsTVOn = true;
                TVHome.ViewChannel(rec.ReferencedChannel());
                if (TVHome.Card.IsTimeShifting)
                {
                    if (g_Player.Playing)
                    {
                        g_Player.SeekAsolutePercentage(99);
                    }
                    g_Player.ShowFullScreenWindow();
                    return;
                }
                break;
            }
            while (m_iSelectedItem >= GetItemCount() && m_iSelectedItem > 0)
            {
                m_iSelectedItem--;
            }
            GUIControl.SelectItemControl(GetID, listPriorities.GetID, m_iSelectedItem);
        }
Esempio n. 27
0
        // Main folders (drives, net shares)
        private void OnAddEditFolder()
        {
            GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU);

            if (dlg == null)
            {
                return;
            }
            dlg.Reset();
            dlg.SetHeading(496);            // Menu

            dlg.AddLocalizedString(300009); // Name
            dlg.AddLocalizedString(300058); // Path
            if (_section == "movies")
            {
                if (_globalVideoThumbsEnaled)
                {
                    dlg.AddLocalizedString(109); // Create thumbs
                }
                dlg.AddLocalizedString(300221);  // Each folder is movie
            }
            //dlg.AddLocalizedString(1374); // layout
            dlg.AddLocalizedString(300059);// Pin

            if (_selectedOption != -1)
            {
                dlg.SelectedLabel = _selectedOption;
            }

            // Show dialog menu
            dlg.DoModal(GetID);

            if (dlg.SelectedId == -1)
            {
                return;
            }

            _selectedOption = dlg.SelectedLabel;

            switch (dlg.SelectedId)
            {
            case 300009:
                OnAddName();
                break;

            case 300058:
                _selectedLabelIndex = -1;
                OnAddPath();
                break;

            case 109:
                OnThumb();
                break;

            case 300221:
                OnMovieFolder();
                break;

            //case 1374:
            //  OnAddLayout();
            //  break;
            case 300059:
                OnAddPin();
                break;
            }
        }
        private void ChangeType(Schedule rec)
        {
            GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU);

            if (dlg != null)
            {
                dlg.Reset();
                dlg.SetHeading(GUILocalizeStrings.Get(616)); //616=Select Recording type
                //611=Record once
                //612=Record everytime on this channel
                //613=Record everytime on every channel
                //614=Record every week at this time
                //615=Record every day at this time
                for (int i = 611; i <= 615; ++i)
                {
                    dlg.Add(GUILocalizeStrings.Get(i));
                }
                dlg.Add(GUILocalizeStrings.Get(WeekEndTool.GetText(DayType.Record_WorkingDays)));
                dlg.Add(GUILocalizeStrings.Get(WeekEndTool.GetText(DayType.Record_WeekendDays)));
                dlg.Add(GUILocalizeStrings.Get(990000));// 990000=Weekly everytime on this channel
                switch ((ScheduleRecordingType)rec.ScheduleType)
                {
                case ScheduleRecordingType.Once:
                    dlg.SelectedLabel = 0;
                    break;

                case ScheduleRecordingType.EveryTimeOnThisChannel:
                    dlg.SelectedLabel = 1;
                    break;

                case ScheduleRecordingType.EveryTimeOnEveryChannel:
                    dlg.SelectedLabel = 2;
                    break;

                case ScheduleRecordingType.Weekly:
                    dlg.SelectedLabel = 3;
                    break;

                case ScheduleRecordingType.Daily:
                    dlg.SelectedLabel = 4;
                    break;

                case ScheduleRecordingType.WorkingDays:
                    dlg.SelectedLabel = 5;
                    break;

                case ScheduleRecordingType.Weekends:
                    dlg.SelectedLabel = 6;
                    break;

                case ScheduleRecordingType.WeeklyEveryTimeOnThisChannel:
                    dlg.SelectedLabel = 7;
                    break;
                }
                dlg.DoModal(GetID);
                if (dlg.SelectedLabel == -1)
                {
                    return;
                }
                switch (dlg.SelectedLabel)
                {
                case 0: //once
                    rec.ScheduleType = (int)ScheduleRecordingType.Once;
                    rec.Canceled     = Schedule.MinSchedule;
                    break;

                case 1: //everytime, this channel
                    rec.ScheduleType = (int)ScheduleRecordingType.EveryTimeOnThisChannel;
                    rec.Canceled     = Schedule.MinSchedule;
                    break;

                case 2: //everytime, all channels
                    rec.ScheduleType = (int)ScheduleRecordingType.EveryTimeOnEveryChannel;
                    rec.Canceled     = Schedule.MinSchedule;
                    break;

                case 3: //weekly
                    rec.ScheduleType = (int)ScheduleRecordingType.Weekly;
                    rec.Canceled     = Schedule.MinSchedule;
                    break;

                case 4: //daily
                    rec.ScheduleType = (int)ScheduleRecordingType.Daily;
                    rec.Canceled     = Schedule.MinSchedule;
                    break;

                case 5: //WorkingDays
                    rec.ScheduleType = (int)ScheduleRecordingType.WorkingDays;
                    rec.Canceled     = Schedule.MinSchedule;
                    break;

                case 6: //Weekends
                    rec.ScheduleType = (int)ScheduleRecordingType.Weekends;
                    rec.Canceled     = Schedule.MinSchedule;
                    break;

                case 7://weekly everytime, this channel
                    rec.ScheduleType = (int)ScheduleRecordingType.WeeklyEveryTimeOnThisChannel;
                    rec.Canceled     = Schedule.MinSchedule;
                    break;
                }
                rec.Persist();
                TvServer server = new TvServer();
                server.OnNewSchedule();
                LoadDirectory();
            }
        }
Esempio n. 29
0
        internal void MyContextMenu()
        {
            try
            {
                GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);
                if (dlg == null)
                {
                    return;
                }

                dlg.Reset();
                dlg.SetHeading(924);

                //Play Menu Item
                GUIListItem pItem = new GUIListItem();
                pItem.Label  = Translation.View;
                pItem.ItemId = 1;
                dlg.Add(pItem);

                pItem        = new GUIListItem();
                pItem.Label  = GUILocalizeStrings.Get(940);
                pItem.ItemId = 2;
                dlg.Add(pItem);

                pItem        = new GUIListItem();
                pItem.Label  = Translation.Update;
                pItem.ItemId = 3;
                dlg.Add(pItem);

                //Show Dialog
                dlg.DoModal(Utils.ActiveWindow);

                if (dlg.SelectedLabel < 0)
                {
                    return;
                }

                switch (dlg.SelectedId)
                {
                case 1:
                {
                    PlayPictures(GUIWindowManager.GetWindow(Utils.ActiveWindow));
                    break;
                }

                case 2:
                {
                    InfoPictures();
                    break;
                }

                case 3:
                {
                    GetLatestPictures();
                    break;
                }
                }
            }
            catch (Exception ex)
            {
                logger.Error("MyContextMenu: " + ex.ToString());
            }
        }
Esempio n. 30
0
        protected override void OnShowContextMenu()
        {
            if (Youtube2MP.NowPlayingEntry == null)
            {
                base.OnShowContextMenu();
                return;
            }
            YouTubeEntry  videoEntry = Youtube2MP.NowPlayingEntry;
            GUIDialogMenu dlg        = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU);

            if (dlg == null)
            {
                return;
            }
            dlg.Reset();
            dlg.SetHeading(Translation.ContextMenu); // menu
            dlg.AddLocalizedString(941);
            dlg.AddLocalizedString(970);
            dlg.Add(Translation.Info);
            if (Youtube2MP.service.Credentials != null)
            {
                dlg.Add(Translation.AddFavorites);
            }
            dlg.Add(Translation.DownloadVideo);
            dlg.DoModal(GetID);
            if (dlg.SelectedId == -1)
            {
                return;
            }
            if (dlg.SelectedLabelText == Translation.Info)
            {
                YoutubeGuiInfoEx scr = (YoutubeGuiInfoEx)GUIWindowManager.GetWindow(29053);
                scr.YouTubeEntry = videoEntry;
                GUIWindowManager.ActivateWindow(29053);
            }
            if (dlg.SelectedLabelText == Translation.AddFavorites)
            {
                try
                {
                    Youtube2MP.service.Insert(new Uri(YouTubeQuery.CreateFavoritesUri(null)), videoEntry);
                }
                catch (Exception)
                {
                    Youtube2MP.Err_message(Translation.WrongRequestWrongUser);
                }
            }

            if (dlg.SelectedLabelText == Translation.DownloadVideo)
            {
                LocalFileStruct fil = Youtube2MP._settings.LocalFile.Get(Youtube2MP.GetVideoId(videoEntry));
                if (fil != null && File.Exists(fil.LocalFile))
                {
                    Youtube2MP.Err_message(Translation.ItemAlreadyDownloaded);
                }
                else
                {
                    if (Youtube2MP.VideoDownloader.IsBusy)
                    {
                        Youtube2MP.Err_message(Translation.AnotherDonwnloadProgress);
                    }
                    else
                    {
                        VideoInfo inf       = Youtube2MP.SelectQuality(videoEntry);
                        string    streamurl = Youtube2MP.StreamPlaybackUrl(videoEntry, inf);
                        Youtube2MP.VideoDownloader.AsyncDownload(streamurl,
                                                                 Youtube2MP._settings.DownloadFolder + "\\" +
                                                                 Utils.MakeFileName(Utils.GetFilename(videoEntry.Title.Text + "{" +
                                                                                                      Youtube2MP.GetVideoId(videoEntry) + "}")) +
                                                                 Path.GetExtension(streamurl) + ".___");
                        GUIPropertyManager.SetProperty("#Youtube.fm.IsDownloading", "true");
                        GUIPropertyManager.SetProperty("#Youtube.fm.Download.Progress", "0");
                        GUIPropertyManager.SetProperty("#Youtube.fm.Download.Item", videoEntry.Title.Text);
                        DatabaseProvider.InstanInstance.Save(videoEntry);
                        Youtube2MP.VideoDownloader.Entry = videoEntry;
                    }
                }
            }

            if (dlg.SelectedId == 941)
            {
                ShowAspectRatioMenu();
            }
            if (dlg.SelectedId == 970)
            {
                GUIWindowManager.IsOsdVisible        = false;
                GUIGraphicsContext.IsFullScreenVideo = false;
                GUIWindowManager.ShowPreviousWindow();
            }
        }