Example #1
0
        private void OnVideoCodec()
        {
            string strVideoCodec = "";

            using (Settings xmlreader = new MPSettings())
            {
                strVideoCodec = xmlreader.GetValueAsString("movieplayer", "mpeg2videocodec", "");
            }
            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)
            {
                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)
            {
                return;
            }
            using (Settings xmlwriter = new MPSettings())
            {
                xmlwriter.SetValue("movieplayer", "mpeg2videocodec", (string)availableVideoFilters[dlg.SelectedLabel]);
            }
        }
Example #2
0
        private void OnAspectRatioDisplayMode()
        {
            AspectRatioDisplayMode aspectRatioDisplayMode = AspectRatioDisplayMode.DisplayContentDefault;

            using (Settings xmlreader = new MPSettings())
            {
                string aspectRatioDisplayModeText = xmlreader.GetValueAsString("dvdplayer", "displaymode", "Default");
                aspectRatioDisplayMode = GetAspectRatioDisplayMode(aspectRatioDisplayModeText);
            }
            GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU);

            if (dlg == null)
            {
                return;
            }

            dlg.Reset();
            dlg.SetHeading(GUILocalizeStrings.Get(496)); //Menu
            dlg.Add("Default");
            dlg.Add("16:9");
            dlg.Add("4:3 Pan Scan");
            dlg.Add("4:3 Letterbox");
            // set the focus to currently used mode
            dlg.SelectedLabel = (int)aspectRatioDisplayMode;
            // show dialog and wait for result
            dlg.DoModal(GetID);

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

            aspectRatioDisplayMode = GetAspectRatioDisplayMode(dlg.SelectedLabelText);

            using (Settings xmlwriter = new MPSettings())
            {
                string aspectRatioDisplayModetext = GetAspectRatioDisplayMode(aspectRatioDisplayMode);
                xmlwriter.SetValue("dvdplayer", "displaymode", aspectRatioDisplayModetext);
            }

            OnAspectRatio();
        }
Example #3
0
        protected void OnShowSortOptions()
        {
            GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);

            if (dlg == null)
            {
                return;
            }
            dlg.Reset();
            dlg.SetHeading(Translation.Sorting); // Sort options

            dlg.Add(Translation.SortByName);     // name
            dlg.Add(Translation.SortByBitrate);  // bitrate
            dlg.Add(Translation.NoSorting);      // no sorting
            // set the focus to currently used sort method
            dlg.SelectedLabel = (int)curSorting;

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

            if (dlg.SelectedLabelText == Translation.SortByBitrate)
            {
                curSorting       = StationSort.SortMethod.bitrate;
                sortButton.Label = Translation.SortByBitrate;
            }
            else if (dlg.SelectedLabelText == Translation.SortByName)
            {
                curSorting       = StationSort.SortMethod.name;
                sortButton.Label = Translation.SortByName;
            }
            else
            {
                curSorting       = StationSort.SortMethod.none;
                sortButton.Label = Translation.NoSorting;
            }

            sortButton.IsAscending = mapSettings.SortAscending;
            UpdateList();
        }
Example #4
0
        public void LabelButtonHandler()
        {
            GUIDialogMenu dlog = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);

            if (dlog == null)
            {
                return;
            }
            dlog.Reset();
            dlog.SetHeading("Choose label");
            dlog.Add("None");
            dlog.Add("No Label");
            foreach (TorrentLabel label in TorrentEngine.Instance().TorrentSession.Labels)
            {
                if (label.Name == "")
                {
                    continue;
                }
                GUIListItem l = new GUIListItem();
                l.Label        = label.Name;
                l.AlbumInfoTag = label.Name;
                dlog.Add(l);
            }

            dlog.DoModal(GUIWindowManager.ActiveWindow);
            switch (dlog.SelectedId)
            {
            case -1:
                return;

            case 1:
                MyTorrents.LabelFilter = null;
                break;

            case 2:
                MyTorrents.LabelFilter = "";
                break;

            default:
                MyTorrents.LabelFilter = dlog.SelectedLabelText;
                break;
            }
        }
Example #5
0
        private void OnChangeGuideChannel(Channel channel)
        {
            GuideChannel[] guideChannels = GuideAgent.GetAllChannels(_currentChannelType);
            if (guideChannels != null && guideChannels.Length > 0)
            {
                GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);
                if (dlg != null)
                {
                    dlg.Reset();
                    dlg.SetHeading(Utility.GetLocalizedText(TextId.SelectGuideChannel));
                    dlg.Add(Utility.GetLocalizedText(TextId.None));

                    int y = 0;
                    for (int i = 0; i < guideChannels.Length; i++)
                    {
                        GUIListItem item = new GUIListItem();
                        item.Label = guideChannels[i].Name;
                        if (channel.GuideChannelId.HasValue && (guideChannels[i].GuideChannelId == channel.GuideChannelId.Value))
                        {
                            item.IsPlayed = true;
                            y             = i + 1;
                        }
                        dlg.Add(item);
                    }
                    dlg.SelectedLabel = y;

                    dlg.DoModal(GetID);
                    if (dlg.SelectedId > 0)
                    {
                        if (dlg.SelectedLabel <= 0)
                        {
                            channel.GuideChannelId = null;
                            SchedulerAgent.SaveChannel(channel);
                        }
                        else
                        {
                            GuideChannel guideChannel = guideChannels[dlg.SelectedLabel - 1];
                            SchedulerAgent.AttachChannelToGuide(channel.ChannelId, guideChannel.GuideChannelId);
                        }
                    }
                }
            }
        }
Example #6
0
        private void OnMovieFolder()
        {
            GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU);

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

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

            if (_folderEachFolderIsMovie)
            {
                selected = 0;
            }

            dlg.Add(GUILocalizeStrings.Get(200031)); //Yes
            dlg.Add(GUILocalizeStrings.Get(200032)); // No

            dlg.SelectedLabel = selected;

            dlg.DoModal(GetID);

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

            if (dlg.SelectedLabel == 0)
            {
                _folderEachFolderIsMovie = true;
            }
            else
            {
                _folderEachFolderIsMovie = false;
            }

            OnAddEditFolder();
        }
        private void OnVC1i()
        {
            ArrayList availableVC1IVideoFilters          = FilterHelper.GetFilters(MediaType.Video, MediaSubType.VC1);
            ArrayList availableVC1ICyberlinkVideoFilters = FilterHelper.GetFilters(MediaType.Video, MediaSubType.CyberlinkVC1);

            while (availableVC1IVideoFilters.Contains("MPC - Video decoder"))
            {
                availableVC1IVideoFilters.Remove("MPC - Video decoder");
                break;
            }
            while (availableVC1IVideoFilters.Contains("WMVideo Decoder DMO"))
            {
                availableVC1IVideoFilters.Remove("WMVideo Decoder DMO");
                break;
            }
            availableVC1IVideoFilters.AddRange(availableVC1ICyberlinkVideoFilters.ToArray());
            availableVC1IVideoFilters.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 availableVC1IVideoFilters)
            {
                dlg.Add(codec); //delete
                if (codec == _strVC1iVideoCodec)
                {
                    selected = count;
                }
                count++;
            }

            dlg.SelectedLabel = selected;

            dlg.DoModal(GetID);

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

            _strVC1iVideoCodec = (string)availableVC1IVideoFilters[dlg.SelectedLabel];
            OnVideo();
        }
Example #8
0
        public static bool ShowBoolDialog(ref bool value, int windowId)
        {
            GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);

            if (dlg != null)
            {
                dlg.Reset();
                dlg.SetHeading(Translator.Instance.options);
                dlg.Add(new GUIListItem(true.ToString()));
                dlg.Add(new GUIListItem(false.ToString()));
                dlg.SelectedLabel = value ? 0 : 1;
                dlg.DoModal(windowId);
                if (dlg.SelectedLabel > -1)
                {
                    value = dlg.SelectedLabel == 0;
                    return(true);
                }
            }
            return(false);
        }
Example #9
0
        private void OnAspectRatioCorrectionMode()
        {
            AspectRatioCorrectionMode aspectRatioCorrectionMode = AspectRatioCorrectionMode.Followstream;

            using (Settings xmlreader = new MPSettings())
            {
                string aspectRatioCorrectionModeText = xmlreader.GetValueAsString("dvdplayer", "armode", "Follow stream");
                aspectRatioCorrectionMode = GetAspectRatioCorrectionMode(aspectRatioCorrectionModeText);
            }
            GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU);

            if (dlg == null)
            {
                return;
            }
            dlg.Reset();
            dlg.SetHeading(GUILocalizeStrings.Get(496)); //Menu
            dlg.Add("Crop");
            dlg.Add("Letterbox");
            dlg.Add("Stretch");
            dlg.Add("Follow Stream");
            // set the focus to currently used mode
            dlg.SelectedLabel = (int)aspectRatioCorrectionMode;
            // show dialog and wait for result
            dlg.DoModal(GetID);

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

            aspectRatioCorrectionMode = GetAspectRatioCorrectionMode(dlg.SelectedLabelText);

            using (Settings xmlwriter = new MPSettings())
            {
                string aspectRatioCorrectionModetext = GetAspectRatioCorrectionMode(aspectRatioCorrectionMode);
                xmlwriter.SetValue("dvdplayer", "armode", aspectRatioCorrectionModetext);
            }
            OnAspectRatio();
        }
Example #10
0
        private void ShowContextMenuTorrentFiles(TorrentFile tor, int idx)
        {
            GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);

            if (dlg == null)
            {
                return;
            }

            dlg.Reset();
            dlg.SetHeading(tor.FileName);

            dlg.Add("Priority - High");
            dlg.Add("Priority - Medium");
            dlg.Add("Priority - Low");
            dlg.Add("Priority - Don't Download");
            dlg.DoModal(GUIWindowManager.ActiveWindow);

            switch (dlg.SelectedLabel)
            {
            case 0:
                MainWindow.uTorrent.FileSetPriority(curTorrent.Hash, idx, TorrentFilePriority.High);
                ShowPageTorrentFiles();
                break;

            case 1:
                MainWindow.uTorrent.FileSetPriority(curTorrent.Hash, idx, TorrentFilePriority.Medium);
                ShowPageTorrentFiles();
                break;

            case 2:
                MainWindow.uTorrent.FileSetPriority(curTorrent.Hash, idx, TorrentFilePriority.Low);
                ShowPageTorrentFiles();
                break;

            case 3:
                MainWindow.uTorrent.FileSetPriority(curTorrent.Hash, idx, TorrentFilePriority.DontDownload);
                ShowPageTorrentFiles();
                break;
            }
        }
Example #11
0
        private void OnchangeEpgSource()
        {
            GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);

            if (dlg != null)
            {
                dlg.Reset();
                dlg.SetHeading(Utility.GetLocalizedText(TextId.PreferedEPGSource));

                dlg.Add(GuideSource.XmlTv.ToString());
                dlg.Add(GuideSource.DvbEpg.ToString());

                int selectedId = 0;
                if (_currentGuideSource == GuideSource.XmlTv)
                {
                    selectedId = 0;
                }
                else if (_currentGuideSource == GuideSource.DvbEpg)
                {
                    selectedId = 1;
                }
                dlg.SelectedLabel = selectedId;

                dlg.DoModal(GetID);
                if (dlg.SelectedId > 0)
                {
                    switch (dlg.SelectedLabel)
                    {
                    case 0:
                        _currentGuideSource = GuideSource.XmlTv;
                        break;

                    case 1:
                        _currentGuideSource = GuideSource.DvbEpg;
                        break;
                    }
                }
            }
        }
Example #12
0
        public ContextMenuAction Show()
        {
            GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);

            if (dlg == null)
            {
                return(PreviousMenu ? ContextMenuAction.PreviousMenu : ContextMenuAction.Exit);
            }
            do
            {
                dlg.Reset();
                if (!string.IsNullOrEmpty(Title))
                {
                    dlg.SetHeading(Title);
                }
                foreach (IMenuItem m in this)
                {
                    dlg.Add(m.Caption);
                }
                if (SelectedLabel != -1)
                {
                    dlg.SelectedLabel = SelectedLabel;
                }
                dlg.DoModal(GUIWindowManager.ActiveWindow);
                if ((dlg.SelectedLabel >= 0) && (dlg.SelectedLabel < Count))
                {
                    IMenuItem obj = this[dlg.SelectedLabel];
                    if (obj is MenuItem)
                    {
                        ContextMenuAction act = ((MenuItem)obj).Function();
                        if (act != ContextMenuAction.Continue)
                        {
                            if (act == ContextMenuAction.PreviousMenu)
                            {
                                return(ContextMenuAction.Continue);
                            }
                            return(act);
                        }
                    }
                    else if (obj is VoidMenuItem)
                    {
                        ((VoidMenuItem)obj).Function();
                        return(ContextMenuAction.Exit);
                    }
                }
                else
                {
                    return(PreviousMenu ? ContextMenuAction.Continue : ContextMenuAction.Exit);
                }
            } while (true);
        }
Example #13
0
        public void FolderClickMenu(GUIListItem fldr, GUIListItem _selectedtorrent, TorrentLabel label)
        {
            GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);

            if (dlg == null)
            {
                return;
            }

            dlg.Reset();
            dlg.SetHeading("Folder Options");
            dlg.Add("Set as download location");
            //dlg.Add("Add to favourite places");
            dlg.DoModal(GUIWindowManager.ActiveWindow);

            switch (dlg.SelectedLabelText)
            {
            case "Set as download location":
            {
                MyTorrents.Instance().HideFolderBrowser();

                if (MyTorrents.ListType == "SeriesInfo")
                {
                    SeriesItem item = _selectedtorrent.AlbumInfoTag as SeriesItem;

                    MyTorrents.Instance()._torrentWatchlist.GetSeriesList().Where(e => e.show.ID == item.show.ID).First().folder = fldr.Path + @"\" + fldr.Label;
                    GUIPropertyManager.SetProperty("#MyTorrents.SeriesInfo.Folder", fldr.Path + @"\" + fldr.Label);
                }
                else
                {
                    DefaultDir = TorrentEngine.Instance().TorrentSession.GetSettings("dir_active_download");
                    string response  = TorrentEngine.Instance().TorrentSession.GetResponse(string.Format("?action=setsetting&s=dir_active_download&v={0}", fldr.Path + @"\" + fldr.Label));
                    string response2 = TorrentEngine.Instance().TorrentSession.GetResponse("?action=setsetting&s=dir_active_download_flag&v=1");
                    TorrentSearch.TorrentMatch match = _selectedtorrent.AlbumInfoTag as TorrentSearch.TorrentMatch;


                    bool ok = TorrentEngine.Instance().StartDownloading(match.Url, label.Name, true, match.cookie, match.Id, _downloadoption, "");
                    if (!ok)
                    {
                        GUIDialogNotify notify = (GUIDialogNotify)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_NOTIFY);
                        notify.Reset();
                        notify.SetHeading("Failed!");
                        notify.SetText("Unable to start download.");
                        notify.DoModal(GUIWindowManager.ActiveWindow);
                    }
                    string revert = TorrentEngine.Instance().TorrentSession.GetResponse(string.Format("?action=setsetting&s=dir_active_download&v={0}", DefaultDir));
                }
                break;
            }
            }
        }
Example #14
0
        private void ChangeChannelType()
        {
            GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);

            if (dlg != null)
            {
                dlg.Reset();
                dlg.SetHeading(Utility.GetLocalizedText(TextId.Type));

                dlg.Add(Utility.GetLocalizedText(TextId.Television));
                dlg.Add(Utility.GetLocalizedText(TextId.Radio));
                switch (_currentChannelType)
                {
                case ChannelType.Television:
                    dlg.SelectedLabel = 0;
                    break;

                case ChannelType.Radio:
                    dlg.SelectedLabel = 1;
                    break;
                }

                dlg.DoModal(GetID);
                if (dlg.SelectedId > 0)
                {
                    switch (dlg.SelectedLabel)
                    {
                    case 0:
                        _currentChannelType = ChannelType.Television;
                        break;

                    case 1:
                        _currentChannelType = ChannelType.Radio;
                        break;
                    }
                }
            }
        }
Example #15
0
        public void SortButtonHandler()
        {
            GUIDialogMenu dlog = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);

            if (dlog == null)
            {
                return;
            }
            dlog.Reset();
            dlog.SetHeading("Choose sort order");
            dlog.Add("Default");
            dlog.Add("By Name ASC");
            dlog.Add("By Name DESC");
            dlog.Add("By Size ASC");
            dlog.Add("By Size DESC");
            if (TorrentEngine.Instance().TorrentsAll[0].AddedOn != 0)
            {
                dlog.Add("By Date Added ASC");
                dlog.Add("By Date Added DESC");
            }
            dlog.DoModal(GUIWindowManager.ActiveWindow);

            switch (dlog.SelectedLabelText)
            {
            case "Default":
                MyTorrents.SortOrder = "Default";
                break;

            case "By Name ASC":
                MyTorrents.SortOrder = "Name ASC";
                break;

            case "By Name DESC":
                MyTorrents.SortOrder = "Name DESC";
                break;

            case "By Size ASC":
                MyTorrents.SortOrder = "Size ASC";
                break;

            case "By Size DESC":
                MyTorrents.SortOrder = "Size DESC";
                break;

            case "By Date Added ASC":
                MyTorrents.SortOrder = "Date Added ASC";
                break;

            case "By Date Added DESC":
                MyTorrents.SortOrder = "Date Added DESC";
                break;
            }
        }
        public void ChooseType(SeriesItem item)
        {
            GUIDialogMenu dialog = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);

            if (dialog == null)
            {
                return;
            }

            dialog.Reset();
            dialog.SetHeading("Choose Watching Type");
            dialog.Add("New episodes");
            dialog.Add("Missing episodes");

            dialog.DoModal(GUIWindowManager.ActiveWindow);

            if (dialog.SelectedId != -1)
            {
                MyTorrents.Instance()._torrentWatchlist.GetSeriesList().Where(e => e.show.ID == item.show.ID).First().type = dialog.SelectedLabelText;

                GUIPropertyManager.SetProperty("#MyTorrents.SeriesInfo.Type", dialog.SelectedLabelText);
            }
        }
Example #17
0
        private void OnDVDNavigator()
        {
            string strDVDNavigator = "";

            using (Settings xmlreader = new MPSettings())
            {
                strDVDNavigator = xmlreader.GetValueAsString("dvdplayer", "navigator", "DVD Navigator");
            }

            ArrayList availableDVDNavigators = FilterHelper.GetDVDNavigators();

            availableDVDNavigators.Sort();

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

            if (dlg == null)
            {
                return;
            }

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

            foreach (string codec in availableDVDNavigators)
            {
                dlg.Add(codec);

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

            dlg.DoModal(GetID);

            if (dlg.SelectedLabel < 0)
            {
                OnVideo();
                return;
            }
            using (Settings xmlwriter = new MPSettings())
            {
                xmlwriter.SetValue("dvdplayer", "navigator", (string)availableDVDNavigators[dlg.SelectedLabel]);
            }
            OnVideo();
        }
        protected void OnShowSavedPlaylists(string _directory)
        {
            VirtualDirectory _virtualDirectory = new VirtualDirectory();

            _virtualDirectory.AddExtension(".m3u");
            _virtualDirectory.AddExtension(".pls");
            _virtualDirectory.AddExtension(".b4s");
            _virtualDirectory.AddExtension(".wpl");

            List <GUIListItem> itemlist = _virtualDirectory.GetDirectoryExt(_directory);

            if (_directory == m_strPlayListPath)
            {
                itemlist.RemoveAt(0);
            }

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

            if (dlg == null)
            {
                return;
            }
            dlg.Reset();
            dlg.SetHeading(983); // Saved Playlists

            foreach (GUIListItem item in itemlist)
            {
                Util.Utils.SetDefaultIcons(item);
                dlg.Add(item);
            }

            dlg.DoModal(GetID);

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

            GUIListItem selectItem = itemlist[dlg.SelectedLabel];

            if (selectItem.IsFolder)
            {
                OnShowSavedPlaylists(selectItem.Path);
                return;
            }

            GUIWaitCursor.Show();
            LoadPlayList(selectItem.Path);
            GUIWaitCursor.Hide();
        }
        public void SearchSeries()
        {
            VirtualKeyboard keyboard = (VirtualKeyboard)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_VIRTUAL_KEYBOARD);

            keyboard.Reset();
            keyboard.Text = "";
            keyboard.DoModal(GUIWindowManager.ActiveWindow);

            if (!keyboard.IsConfirmed)
            {
                return;
            }

            IList <TraktShow> searchshow = TraktAPI.SearchShows(keyboard.Text).ToList();
            GUIDialogMenu     dialog     = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);

            if (dialog == null)
            {
                return;
            }

            dialog.Reset();
            dialog.SetHeading("Choose TV Series to add");
            foreach (TraktShow ts in searchshow)
            {
                dialog.Add(string.Format("{0} - ({1})", ts.Title, ts.Year));
            }
            dialog.DoModal(GUIWindowManager.ActiveWindow);

            if (dialog.SelectedId != -1)
            {
                TraktShow  t    = searchshow[dialog.SelectedId - 1];
                SeriesItem item = new SeriesItem();
                item.quality           = "720p";
                item.show              = new Series();
                item.show.Name         = t.Title;
                item.show.OriginalName = t.Title;
                item.show.Description  = t.Overview;
                foreach (string genre in t.Genres)
                {
                    item.show.Genres += "|" + genre;
                }
                item.show.Rating = ((double)t.Ratings.Percentage / 10.0).ToString();
                item.show.Poster = t.Images.Banner;
                item.show.ID     = t.Tvdb;
                item.tracker     = "BTN";
                MyTorrents.Instance()._torrentWatchlist._watchItemList.Add(item);
            }
        }
        private void OnSplitter()
        {
            ArrayList availableSourcesFilters  = FilterHelper.GetFilterSource();
            ArrayList availableFileSyncFilters = FilterHelper.GetFilters(MediaType.Stream, MediaSubType.Null);

            while (availableFileSyncFilters.Contains("Haali Media Splitter (AR)"))
            {
                availableSourcesFilters.Add("Haali Media Splitter");
                break;
            }

            availableSourcesFilters.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 availableSourcesFilters)
            {
                dlg.Add(codec); //delete
                if (codec == _strSplitterFilter)
                {
                    selected = count;
                }
                count++;
            }

            dlg.SelectedLabel = selected;

            dlg.DoModal(GetID);

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

            _strSplitterFilter = (string)availableSourcesFilters[dlg.SelectedLabel];
            OnVideo();
        }
Example #21
0
        private int?GetKeepValue(int heading, KeepUntilMode mode, int singularName, int pluralName, int?currentValue)
        {
            DataTable     valueTable = KeepUntilControlUtility.CreateValueTable(mode, currentValue);
            GUIDialogMenu dlg        = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);

            if (dlg != null)
            {
                dlg.Reset();
                dlg.ShowQuickNumbers = false;
                dlg.SetHeading(heading);

                string singularValue = "1 " + GUILocalizeStrings.Get(singularName);
                string pluralSuffix  = " " + GUILocalizeStrings.Get(pluralName);

                foreach (DataRow value in valueTable.Rows)
                {
                    int val = (int)value[KeepUntilControlUtility.ValueColumnName];
                    if (val == 1)
                    {
                        dlg.Add(singularValue);
                    }
                    else
                    {
                        dlg.Add(value[KeepUntilControlUtility.TextColumnName] + pluralSuffix);
                    }
                }

                dlg.SelectedLabel = KeepUntilControlUtility.GetIndexToSelect(valueTable, currentValue);
                dlg.DoModal(GetID);
                if (dlg.SelectedLabel >= 0)
                {
                    return((int)valueTable.Rows[dlg.SelectedLabel][KeepUntilControlUtility.ValueColumnName]);
                }
            }
            return(null);
        }
Example #22
0
        static bool showSimpleContext(GUIPresenter presenter, int selectedLabel = 0)
        {
            GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);

            if (dlg != null)
            {
                dlg.Reset();
                dlg.SetHeading(Options.Instance.GetStringOption("shownname"));

                dlg.Add(new GUIListItem(Translator.Instance.switchview));
                dlg.Add(new GUIListItem(Translator.Instance.runimport));
                dlg.Add(new GUIListItem(Translator.Instance.options));
                dlg.SelectedLabel = selectedLabel;
                dlg.DoModal(Plugin.WINDOW_ID);
                selectedLabel = dlg.SelectedLabel;
                switch (dlg.SelectedId)
                {
                case 1:
                    presenter.SwitchView();
                    break;

                case 2:
                    presenter.RestartImporter();
                    break;

                case 3:
                    if (ShowSettingsDialog())
                    {
                        presenter.ReloadOptions();
                    }
                    showSimpleContext(presenter, selectedLabel);
                    break;
                }
            }
            return(false);
        }
Example #23
0
 private GUIDialogMenu BuildDialogSelect(IEnumerable <GUIListItem> list)
 {
     _dlgSelect = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);
     _dlgSelect.ResetAllControls();
     _dlgSelect.Reset();
     _dlgSelect.Init();
     _dlgSelect.InitControls();
     _dlgSelect.Process();
     _dlgSelect.SetHeading("Context Menu");
     foreach (GUIListItem item in list)
     {
         _dlgSelect.Add(item);
     }
     return(_dlgSelect);
 }
Example #24
0
        public static bool DialogSelectGFQuickSortDirection(ref GroupFilterSortDirection sortDirection, string previousMenu)
        {
            //show the selection dialog
            GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);

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

            dlg.Reset();
            dlg.SetHeading("Sort Direction");

            dlg.Add("<<< " + previousMenu);
            dlg.Add("Ascending");
            dlg.Add("Descending");

            dlg.DoModal(GUIWindowManager.ActiveWindow);
            int selection = dlg.SelectedLabel;

            if (selection <= 0)
            {
                return(true);
            }

            if (selection == 1)
            {
                sortDirection = GroupFilterSortDirection.Asc;
            }
            if (selection == 2)
            {
                sortDirection = GroupFilterSortDirection.Desc;
            }

            return(true);
        }
Example #25
0
        private void OnAudioRenderer()
        {
            string strAudioRenderer = "";

            using (Settings xmlreader = new MPSettings())
            {
                strAudioRenderer = xmlreader.GetValueAsString("dvdplayer", "audiorenderer", "Default DirectSound Device");
            }

            ArrayList     availableAudioFilters = FilterHelper.GetAudioRenderers();
            GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU);

            if (dlg == null)
            {
                return;
            }

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

            foreach (string codec in availableAudioFilters)
            {
                dlg.Add(codec); //delete
                if (codec == strAudioRenderer)
                {
                    selected = count;
                }
                count++;
            }

            dlg.SelectedLabel = selected;
            dlg.DoModal(GetID);

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

            using (Settings xmlwriter = new MPSettings())
            {
                xmlwriter.SetValue("dvdplayer", "audiorenderer", (string)availableAudioFilters[dlg.SelectedLabel]);
            }

            OnAudio();
        }
        private void OnAudioLanguage()
        {
            GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU);

            if (dlg != null)
            {
                dlg.Reset();
                dlg.SetHeading(GUILocalizeStrings.Get(496)); //Menu
                dlg.ShowQuickNumbers = false;
                int           selected      = 0;
                ArrayList     cultures      = new ArrayList();
                CultureInfo[] culturesInfos = CultureInfo.GetCultures(CultureTypes.NeutralCultures);

                for (int i = 0; i < culturesInfos.Length; ++i)
                {
                    cultures.Add(culturesInfos[i]);
                }

                cultures.Sort(new CultureComparer());

                for (int i = 0; i < cultures.Count; ++i)
                {
                    CultureInfo info = (CultureInfo)cultures[i];

                    if (info.Name.Equals(_defaultAudioLanguage))
                    {
                        selected = i;
                    }
                    dlg.Add(info.EnglishName);
                }

                _infoAudio        = (CultureInfo)cultures[selected];
                dlg.SelectedLabel = selected;
                dlg.DoModal(GetID);

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

                _defaultAudioLanguage = dlg.SelectedLabelText;
                _infoAudio            = (CultureInfo)cultures[dlg.SelectedLabel];
                OnAudio();
            }
        }
Example #27
0
        public static void OnSetEpisodesToKeep(Schedule rec)
        {
            Schedule      schedule = Schedule.Retrieve(rec.IdSchedule);
            GUIDialogMenu dlg      = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU);

            if (dlg == null)
            {
                return;
            }
            dlg.Reset();
            dlg.SetHeading(887);         //quality settings
            dlg.ShowQuickNumbers = false;
            dlg.AddLocalizedString(889); //All episodes
            for (int i = 1; i < 40; ++i)
            {
                dlg.Add(i.ToString() + " " + GUILocalizeStrings.Get(874));
            }
            if (schedule.MaxAirings == Int32.MaxValue)
            {
                dlg.SelectedLabel = 0;
            }
            else
            {
                dlg.SelectedLabel = schedule.MaxAirings;
            }

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

            if (dlg.SelectedLabel == 0)
            {
                schedule.MaxAirings = Int32.MaxValue;
            }
            else
            {
                schedule.MaxAirings = dlg.SelectedLabel;
            }
            schedule.Persist();
            TvServer server = new TvServer();

            server.OnNewSchedule();
        }
        private void OnAudioLanguage()
        {
            string defaultAudioLanguage = "";

            using (Settings xmlreader = new MPSettings())
            {
                defaultAudioLanguage = xmlreader.GetValueAsString("dvdplayer", "audiolanguage", "English");
            }
            GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU);

            if (dlg != null)
            {
                dlg.Reset();
                dlg.SetHeading(GUILocalizeStrings.Get(496)); //Menu
                dlg.ShowQuickNumbers = false;
                int           selected      = 0;
                ArrayList     cultures      = new ArrayList();
                CultureInfo[] culturesInfos = CultureInfo.GetCultures(CultureTypes.NeutralCultures);
                for (int i = 0; i < culturesInfos.Length; ++i)
                {
                    cultures.Add(culturesInfos[i]);
                }
                cultures.Sort(new CultureComparer());
                for (int i = 0; i < cultures.Count; ++i)
                {
                    CultureInfo info = (CultureInfo)cultures[i];
                    if (info.EnglishName.Equals(defaultAudioLanguage))
                    {
                        selected = i;
                    }
                    dlg.Add(info.EnglishName);
                }
                dlg.SelectedLabel = selected;
                dlg.DoModal(GetID);
                if (dlg.SelectedLabel < 0)
                {
                    return;
                }
                using (Settings xmlwriter = new MPSettings())
                {
                    CultureInfo info = (CultureInfo)cultures[dlg.SelectedLabel];
                    xmlwriter.SetValue("dvdplayer", "audiolanguage", info.EnglishName);
                }
            }
        }
Example #29
0
        /// <summary>
        /// Play by Selected Tag
        /// </summary>
        private void playByTag()
        {
            GUIDialogMenu dlgMenu = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);

            if (dlgMenu != null)
            {
                dlgMenu.Reset();
                dlgMenu.SetHeading(mvCentralUtils.PluginName() + " - " + Localization.SmartPlaylistOptions);
                foreach (string artistTag in artistTags)
                {
                    dlgMenu.Add(artistTag);
                }
                dlgMenu.DoModal(GetID);

                if (dlgMenu.SelectedLabel == -1) // Nothing was selected
                {
                    return;
                }

                //dlgMenu.SelectedLabelText
                PlayList playlist = Player.playlistPlayer.GetPlaylist(PlayListType.PLAYLIST_MVCENTRAL);
                playlist.Clear();
                List <DBArtistInfo> allArtists = DBArtistInfo.GetAll();
                foreach (DBArtistInfo artist in allArtists)
                {
                    if (artist.Tag.Contains(dlgMenu.SelectedLabelText))
                    {
                        List <DBTrackInfo> theTracks = DBTrackInfo.GetEntriesByArtist(artist);
                        foreach (DBTrackInfo artistTrack in theTracks)
                        {
                            playlist.Add(new PlayListItem(artistTrack));
                        }
                    }
                }
                Player.playlistPlayer.CurrentPlaylistType = PlayListType.PLAYLIST_MVCENTRAL;
                playlist.Shuffle();
                Player.playlistPlayer.Play(0);
                if (mvCentralCore.Settings.AutoFullscreen)
                {
                    GUIWindowManager.ActivateWindow((int)GUIWindow.Window.WINDOW_FULLSCREEN_VIDEO);
                }
            }
        }
        private void OnDivX()
        {
            ArrayList availableXVIDVideoFilters = FilterHelper.GetFilters(MediaType.Video, MediaSubType.XVID);

            availableXVIDVideoFilters.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 availableXVIDVideoFilters)
            {
                dlg.Add(codec); //delete
                if (codec == _strDivXVideoCodec)
                {
                    selected = count;
                }
                count++;
            }

            dlg.SelectedLabel = selected;

            dlg.DoModal(GetID);

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

            _strDivXVideoCodec = (string)availableXVIDVideoFilters[dlg.SelectedLabel];
            OnVideo();
        }