Example #1
0
 private void _onlineContentBrowser_FormClosed(object sender, FormClosedEventArgs e)
 {
     _onlineContentBrowser = null;
 }
Example #2
0
        public void OnExecuteShortcut(OPMShortcutEventArgs args)
        {
            if (args.Handled)
            {
                return;
            }

            Logger.LogInfo("OnExecuteShortcut enter: " + args);

            if (_renderingFrame == null || !_renderingFrame.Visible)
            {
                pnlScreens.Focus();
            }

            switch (args.cmd)
            {
            case OPMShortcut.CmdPlayPause:
                if (MediaRenderer.DefaultInstance.FilterState == FilterState.Paused ||
                    MediaRenderer.DefaultInstance.FilterState == FilterState.Running)
                {
                    Pause();
                    args.Handled = true;
                }
                else
                {
                    Play();
                    args.Handled = true;
                }
                break;

            case OPMShortcut.CmdStop:
                Stop(true);
                args.Handled = true;
                break;

            case OPMShortcut.CmdPrev:
                MovePrevious();
                args.Handled = true;
                break;

            case OPMShortcut.CmdNext:
                MoveNext();
                args.Handled = true;
                break;

            case OPMShortcut.CmdLoad:
                LoadFiles();
                args.Handled = true;
                break;

            case OPMShortcut.CmdFwd:
                MoveToPosition(pnlRendering.ElapsedSeconds + 5);
                args.Handled = true;
                break;

            case OPMShortcut.CmdRew:
                MoveToPosition(pnlRendering.ElapsedSeconds - 5);
                args.Handled = true;
                break;

            case OPMShortcut.CmdVolUp:
                pnlRendering.ProjectedVolume += 500;
                SetVolume(pnlRendering.ProjectedVolume);
                args.Handled = true;
                break;

            case OPMShortcut.CmdVolDn:
                pnlRendering.ProjectedVolume -= 500;
                SetVolume(pnlRendering.ProjectedVolume);
                args.Handled = true;
                break;

            case OPMShortcut.CmdFullScreen:
                ToggleFullScreen();
                args.Handled = true;
                break;

            case OPMShortcut.CmdOpenDisk:
                LoadDisc();
                args.Handled = true;
                break;

            case OPMShortcut.CmdCfgAudio:
                FfdShowConfig.DoConfigureAudio(this.Handle);
                args.Handled = true;
                break;

            case OPMShortcut.CmdCfgVideo:
                FfdShowConfig.DoConfigureVideo(this.Handle);
                args.Handled = true;
                break;

            case OPMShortcut.CmdCfgSubtitles:
                ProTONESettingsForm.Show("TXT_S_SUBTITLESETTINGS", "TXT_S_SUBTITLESETTINGS");
                args.Handled = true;
                break;

            case OPMShortcut.CmdCfgTimer:
                ProTONESettingsForm.Show("TXT_S_MISC_SETTINGS", "TXT_S_SCHEDULERSETTINGS");
                args.Handled = true;
                break;

            case OPMShortcut.CmdCfgRemote:
                ProTONESettingsForm.Show("TXT_S_CONTROL", "TXT_REMOTECONTROLCFG");
                args.Handled = true;
                break;

            case OPMShortcut.CmdOpenSettings:
                DialogResult dlgResult = ProTONESettingsForm.Show();
                args.Handled = true;
                break;

            case OPMShortcut.CmdCfgKeyboard:
                ProTONESettingsForm.Show("TXT_S_CONTROL", "TXT_S_KEYMAP");
                args.Handled = true;
                break;

            case OPMShortcut.CmdOpenURL:
            {
                args.Handled = true;

                //StreamingServerChooserDlg dlg2 = new StreamingServerChooserDlg();
                //dlg2.Show();

                if (_onlineContentBrowser == null)
                {
                    _onlineContentBrowser              = new OnlineContentBrowser();
                    _onlineContentBrowser.FormClosing += new FormClosingEventHandler(_onlineContentBrowser_FormClosing);
                    _onlineContentBrowser.FormClosed  += _onlineContentBrowser_FormClosed;
                    _onlineContentBrowser.Shown       += new EventHandler(_onlineContentBrowser_Shown);
                }

                _onlineContentBrowser.Show();

                /*
                 * if (dlg2.ShowDialog() == DialogResult.OK)
                 * {
                 *  string textUrl = dlg2.Uri;
                 *  string radioStationUrl = dlg2.RadioStation != null ? dlg2.RadioStation.Url : string.Empty;
                 *
                 *  if (string.Compare(textUrl, radioStationUrl, true) != 0)
                 *  {
                 *      // Load the specified url (manually entered by the user)
                 *      string[] urls = new string[] { textUrl };
                 *      LoadFiles(urls);
                 *  }
                 *  else if (dlg2.RadioStation != null)
                 *  {
                 *      LoadRadioStation(dlg2.RadioStation);
                 *  }
                 * }*/
            }
            break;

            case OPMShortcut.CmdSearchSubtitles:
            {
                args.Handled = true;

                PlaylistItem plItem = pnlScreens.PlaylistScreen.GetPlaylistItemForEditing();
                if (plItem != null &&
                    plItem.MediaFileInfo is VideoFileInfo)
                {
                    SubtitleDownloadProcessor.TryFindSubtitle(plItem.Path, (int)plItem.Duration.TotalSeconds, true);
                }
            }
            break;

            default:
                pnlScreens.OnExecuteShortcut(args);
                break;
            }

            Logger.LogInfo("OnExecuteShortcut leave");
        }