protected override void SetView(int selectedViewId)
        {
            switch (selectedViewId)
            {
            case 0: // Shares
            {
                int nNewWindow = (int)Window.WINDOW_VIDEOS;
                VideoState.StartWindow = nNewWindow;
                if (nNewWindow != GetID)
                {
                    GUIVideoFiles.Reset();
                    GUIWindowManager.ReplaceWindow(nNewWindow);
                }
            }
            break;

            default: // a db view
            {
                ViewDefinition selectedView = (ViewDefinition)handler.Views[selectedViewId - 1];
                handler.CurrentView = selectedView.Name;
                VideoState.View     = selectedView.Name;
                int nNewWindow = (int)Window.WINDOW_VIDEO_TITLE;
                // Reset search variables
                if (GUIVideoTitle.CurrentViewHistory != handler.CurrentLevelWhere)
                {
                    GUIVideoTitle.IsActorSearch            = false;
                    GUIVideoTitle.IsMovieSearch            = false;
                    GUIVideoTitle.ActorSearchString        = string.Empty;
                    GUIVideoTitle.MovieSearchString        = string.Empty;
                    GUIVideoTitle.MovieSearchDbFieldString = string.Empty;
                }
                if (GetID != nNewWindow)
                {
                    VideoState.StartWindow = nNewWindow;
                    if (nNewWindow != GetID)
                    {
                        GUIWindowManager.ReplaceWindow(nNewWindow);
                    }
                }
                else
                {
                    LoadDirectory(string.Empty);
                    if (facadeLayout.Count <= 0)
                    {
                        GUIControl.FocusControl(GetID, btnLayouts.GetID);
                    }
                }
            }
            break;
            }
        }
        private void Close()
        {
            Console.WriteLine("Closing Cover Art Grabber Progress Window...");
            _Abort = true;

            if (GuiCoverArtResults != null)
            {
                GuiCoverArtResults.AmazonWebService.AbortGrab = true;
            }

            HideWaitCursor();
            EnableControls(true);

            if (!GrabInProgress)
            {
                GUIWindowManager.ReplaceWindow(m_dwParentWindowID);
            }
        }
Exemple #3
0
        //do the init before page load
        protected override void OnPageLoad()
        {
            updateStationLogoTimer.Enabled = true;

            if (!string.IsNullOrEmpty(Settings.GuideId))
            {
                grabber.GetData(string.Format("http://opml.radiotime.com/Browse.ashx?id={0}&{1}", Settings.GuideId,
                                              grabber.Settings.GetParamString()), Settings.GuideIdDescription);
                Settings.GuideId            = string.Empty;
                Settings.GuideIdDescription = string.Empty;
            }
            else
            {
                //if (grabber.Body.Count < 1)
                if (_setting.FirtsStart)
                {
                    if (_setting.ShowPresets)
                    {
                        grabber.GetData(_setting.StartupUrl, _setting.PluginName);
                        grabber.GetData(_setting.PresetsUrl, false, Translation.Presets);
                        oldSelection = 1;
                    }
                    else
                    {
                        Log.Info("RadioTime page loading :{0}", _setting.StartupUrl);
                        grabber.GetData(_setting.StartupUrl, _setting.PluginName);
                        //grabber.Body.Add(new RadioTimeOutline() { Url = "http://opml.radiotime.com/Search.ashx?query=aa2", Type = RadioTimeOutline.OutlineType.link, Text = "Test feeed" });
                    }
                }
            }


            GUIPropertyManager.SetProperty("#header.label", " ");
            GUIPropertyManager.SetProperty("#RadioTime.Selected.NowPlaying", " ");
            GUIPropertyManager.SetProperty("#RadioTime.Selected.Subtext", " ");
            GUIPropertyManager.SetProperty("#RadioTime.Selected.Format", " ");
            GUIPropertyManager.SetProperty("#RadioTime.Selected.Reliability", "0");

            UpdateList();
            listControl.SelectedListItemIndex = oldSelection;

            GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_SETFOCUS, GetID, 0, 50, 0, 0, null);

            OnMessage(msg);

            if (sortButton != null)
            {
                sortButton.SortChanged += SortChanged;
            }

            // set the sort button label
            switch (curSorting)
            {
            case StationSort.SortMethod.bitrate:
                sortButton.Label = Translation.SortByBitrate;
                break;

            case StationSort.SortMethod.name:
                sortButton.Label = Translation.SortByName;
                break;

            case StationSort.SortMethod.none:
                sortButton.Label = Translation.NoSorting;
                break;
            }
            sortButton.IsAscending = mapSettings.SortAscending;

            foreach (string name in Translation.Strings.Keys)
            {
                SetProperty("#RadioTime.Translation." + name + ".Label", Translation.Strings[name]);
            }

            g_Player.PlayBackStarted += g_Player_PlayBackStartedFromGUI;

            if (_setting.StartWithFastPreset && _setting.FirtsStart)
            {
                _setting.FirtsStart = false;
                GUIWindowManager.ReplaceWindow(25653);
            }
            _setting.FirtsStart = false;
            base.OnPageLoad();
        }
        protected virtual void SetView(int selectedViewId)
        {
            bool isVideoWindow = (this.GetID == (int)Window.WINDOW_VIDEOS || this.GetID == (int)Window.WINDOW_VIDEO_TITLE);

            switch (selectedViewId)
            {
            case 0: // Shares
            {
                int nNewWindow;
                if (isVideoWindow)
                {
                    nNewWindow = (int)Window.WINDOW_VIDEOS;
                }
                else
                {
                    nNewWindow = (int)Window.WINDOW_MUSIC_FILES;
                }
                StateBase.StartWindow = nNewWindow;
                if (nNewWindow != GetID)
                {
                    if (isVideoWindow)
                    {
                        MediaPortal.GUI.Video.GUIVideoFiles.Reset();
                    }
                    GUIWindowManager.ReplaceWindow(nNewWindow);
                }
            }
            break;

            case 4540: // Now playing
            {
                int nPlayingNowWindow = (int)Window.WINDOW_MUSIC_PLAYING_NOW;

                MediaPortal.GUI.Music.GUIMusicPlayingNow guiPlayingNow =
                    (MediaPortal.GUI.Music.GUIMusicPlayingNow)GUIWindowManager.GetWindow(nPlayingNowWindow);

                if (guiPlayingNow != null)
                {
                    guiPlayingNow.MusicWindow = (MediaPortal.GUI.Music.GUIMusicBaseWindow) this;
                    GUIWindowManager.ActivateWindow(nPlayingNowWindow);
                }
            }
            break;

            default: // a db view
            {
                ViewDefinition selectedView = (ViewDefinition)handler.Views[selectedViewId - 1];
                handler.CurrentView = selectedView.Name;
                StateBase.View      = selectedView.Name;
                int nNewWindow;
                if (isVideoWindow)
                {
                    nNewWindow = (int)Window.WINDOW_VIDEO_TITLE;
                    // Reset search variables
                    if (GUIVideoTitle.CurrentViewHistory != handler.CurrentLevelWhere)
                    {
                        GUIVideoTitle.IsActorSearch            = false;
                        GUIVideoTitle.IsMovieSearch            = false;
                        GUIVideoTitle.ActorSearchString        = string.Empty;
                        GUIVideoTitle.MovieSearchString        = string.Empty;
                        GUIVideoTitle.MovieSearchDbFieldString = string.Empty;
                    }
                }
                else
                {
                    nNewWindow = (int)Window.WINDOW_MUSIC_GENRE;
                }
                if (GetID != nNewWindow)
                {
                    StateBase.StartWindow = nNewWindow;
                    if (nNewWindow != GetID)
                    {
                        GUIWindowManager.ReplaceWindow(nNewWindow);
                    }
                }
                else
                {
                    LoadDirectory(string.Empty);
                    if (facadeLayout.Count <= 0)
                    {
                        GUIControl.FocusControl(GetID, btnLayouts.GetID);
                    }
                }
            }
            break;
            }
        }
        protected virtual void OnShowViews()
        {
            GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU);

            if (dlg == null)
            {
                return;
            }
            dlg.Reset();
            dlg.SetHeading(499);         // Views menu

            dlg.AddLocalizedString(134); // Shares
            foreach (ViewDefinition view in handler.Views)
            {
                dlg.Add(view.LocalizedName);
            }
            bool isVideoWindow = (this.GetID == (int)Window.WINDOW_VIDEOS || this.GetID == (int)Window.WINDOW_VIDEO_TITLE);

            // set the focus to currently used view
            if (this.GetID == (int)Window.WINDOW_VIDEOS || this.GetID == (int)Window.WINDOW_MUSIC_FILES)
            {
                dlg.SelectedLabel = 0;
            }
            else if (this.GetID == (int)Window.WINDOW_VIDEO_TITLE || this.GetID == (int)Window.WINDOW_MUSIC_GENRE)
            {
                dlg.SelectedLabel = handler.CurrentViewIndex + 1;
            }

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

            switch (dlg.SelectedId)
            {
            case 134: // Shares
            {
                int nNewWindow;
                if (isVideoWindow)
                {
                    nNewWindow = (int)Window.WINDOW_VIDEOS;
                }
                else
                {
                    nNewWindow = (int)Window.WINDOW_MUSIC_FILES;
                }
                StateBase.StartWindow = nNewWindow;
                if (nNewWindow != GetID)
                {
                    if (isVideoWindow)
                    {
                        MediaPortal.GUI.Video.GUIVideoFiles.Reset();
                    }
                    GUIWindowManager.ReplaceWindow(nNewWindow);
                }
            }
            break;

            case 4540: // Now playing
            {
                int nPlayingNowWindow = (int)Window.WINDOW_MUSIC_PLAYING_NOW;

                MediaPortal.GUI.Music.GUIMusicPlayingNow guiPlayingNow =
                    (MediaPortal.GUI.Music.GUIMusicPlayingNow)GUIWindowManager.GetWindow(nPlayingNowWindow);

                if (guiPlayingNow != null)
                {
                    guiPlayingNow.MusicWindow = (MediaPortal.GUI.Music.GUIMusicBaseWindow) this;
                    GUIWindowManager.ActivateWindow(nPlayingNowWindow);
                }
            }
            break;

            default: // a db view
            {
                ViewDefinition selectedView = (ViewDefinition)handler.Views[dlg.SelectedLabel - 1];
                handler.CurrentView = selectedView.Name;
                StateBase.View      = selectedView.Name;
                int nNewWindow;
                if (isVideoWindow)
                {
                    nNewWindow = (int)Window.WINDOW_VIDEO_TITLE;
                }
                else
                {
                    nNewWindow = (int)Window.WINDOW_MUSIC_GENRE;
                }
                if (GetID != nNewWindow)
                {
                    StateBase.StartWindow = nNewWindow;
                    if (nNewWindow != GetID)
                    {
                        GUIWindowManager.ReplaceWindow(nNewWindow);
                    }
                }
                else
                {
                    LoadDirectory(string.Empty);
                    if (facadeLayout.Count <= 0)
                    {
                        GUIControl.FocusControl(GetID, btnLayouts.GetID);
                    }
                }
            }
            break;
            }
        }