Exemplo n.º 1
0
 private Dialog()
 {
     _dlgSelect = new GUIDialogMenu();
     _lstSelectStatus = BuildDialogSelectList(typeof(Enums.StatusType));
     _lstSelectMood = BuildDialogSelectList(typeof(Enums.MoodType));
     _lstSelectActivity = BuildDialogSelectList(typeof(Enums.ActivityType));
 }
Exemplo n.º 2
0
 /// <summary>
 /// Constructor, which creates all elements
 /// </summary>
 public DialogWindow()
 {
     _dialogWindow = GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU) as GUIDialogMenu;
       if (_dialogWindow != null)
       {
       _controlList = _dialogWindow.controlList;
       GenerateElements();
       }
 }
Exemplo n.º 3
0
 /// <summary>
 /// Performs a base init of the window. This includes the following tasks
 /// - Setting the reference to the window in MP
 /// - Setting the reference to the control list of the MP window
 /// </summary>
 protected override void BaseInit()
 {
     _dialogWindow = GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU) as GUIDialogMenu;
       _baseWindow = _dialogWindow;
       if (_dialogWindow != null)
       {
     _controlList = new GUIControlCollection();
     foreach (var baseElement in _dialogWindow.controlList)
     {
       _controlList.Add(baseElement);
     }
       }
 }
Exemplo n.º 4
0
        public MpDialogMenu(MediaPortal.Dialogs.GUIDialogMenu menu)
            : base(menu)
        {
            this.DialogType = menu.GetModuleName();
            this.DialogId = menu.GetID;
            this.menu = menu;
            this.ListItems = new List<FacadeItem>();

            this.AvailableActions.Add("listselect");
            this.AvailableActions.Add("cancel");

            GetHeading(menu, 4);
        }
Exemplo n.º 5
0
        public MpDialogMenu(MediaPortal.Dialogs.GUIDialogMenu menu)
            : base(menu)
        {
            this.DialogType = menu.GetModuleName();
            this.DialogId   = menu.GetID;
            this.menu       = menu;
            this.ListItems  = new List <FacadeItem>();

            this.AvailableActions.Add("listselect");
            this.AvailableActions.Add("cancel");

            GetHeading(menu, 4);
        }
Exemplo n.º 6
0
 /// <summary>
 /// Performs a base init of the window. This includes the following tasks
 /// - Setting the reference to the window in MP
 /// - Setting the reference to the control list of the MP window
 /// </summary>
 protected override void BaseInit()
 {
     _dialogWindow = GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU) as GUIDialogMenu;
       if (_dialogWindow != null)
     _controlList = _dialogWindow.controlList;
 }
Exemplo n.º 7
0
    public void ShowBookmarksMenu()
    {
      if (dlg == null)
      {
        dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU);
      }
      if (dlg == null)
      {
        return;
      }

      dlg.Reset();
      dlg.SetHeading(1064); // Bookmarks

      // load the stored bookmarks
      ArrayList bookmarks = new ArrayList();
      VideoDatabase.GetBookMarksForMovie(g_Player.CurrentFile, ref bookmarks);
      List<double> bookmarkList = new List<double>();
      for (int i = 0; i < bookmarks.Count; i++)
      {
        bookmarkList.Add((double)bookmarks[i]);
      }
      bookmarkList.Sort();

      dlg.AddLocalizedString(294); // create Bookmark
      if (bookmarkList.Count > 0)
      {
        dlg.AddLocalizedString(296); // clear Bookmarks
      }

      // align the time right
      for (int i = 0; i < bookmarkList.Count; ++i)
      {
        GUIListItem item = new GUIListItem();
        item.Label = GUILocalizeStrings.Get(1065); // Jump to
        item.Label2 = Util.Utils.SecondsToHMSString((int)bookmarkList[i]);

        dlg.Add(item);
      }
      // show only the time on the left
      //for (int i = 0; i < bookmarkList.Count; ++i)
      //  dlg.Add(Util.Utils.SecondsToHMSString((int)bookmarkList[i]));

      _IsDialogVisible = true;
      dlg.DoModal(GetID);
      _IsDialogVisible = false;

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

      if (dlg.SelectedLabel == 0)
      {
        // get the current playing time position
        double dCurTime = g_Player.CurrentPosition;
        // add the current timestamp
        VideoDatabase.AddBookMarkToMovie(g_Player.CurrentFile, (float)dCurTime);
      }
      else if (dlg.SelectedLabel == 1)
      {
        // empty the bookmarks table for this movie
        VideoDatabase.ClearBookMarksOfMovie(g_Player.CurrentFile);
      }
      else
      {
        // get selected bookmark
        // dlg[0] = create, dlg[1] = clearAll --> dlg[2] = bookmark[0]
        int selectedBookmarkIndex = dlg.SelectedLabel - 2;

        // set mplayers play position
        g_Player.SeekAbsolute(bookmarkList[selectedBookmarkIndex]);
      }
    }
Exemplo n.º 8
0
    private void ShowContextMenu()
    {
      if (dlg == null)
      {
        dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU);
      }
      if (dlg == null)
      {
        return;
      }
      dlg.Reset();
      dlg.SetHeading(498); // menu

      dlg.AddLocalizedString(941); // Change aspect ratio

      // Audio stream selection, show only when more than one streams exists
      if ((g_Player.ShowMenuItems & MenuItems.Audio) == MenuItems.Audio && g_Player.AudioStreams > 1)
      {
        dlg.AddLocalizedString(492);
      }

      // Edition stream selection, show only when more than one streams exists
      if (g_Player.EditionStreams > 1)
      {
        dlg.AddLocalizedString(200090);
      }

      // Video stream selection, show only when more than one streams exists
      if (g_Player.VideoStreams > 1)
      {
        dlg.AddLocalizedString(200095);
      }

      eAudioDualMonoMode dualMonoMode = g_Player.GetAudioDualMonoMode();
      if (dualMonoMode != eAudioDualMonoMode.UNSUPPORTED)
      {
        dlg.AddLocalizedString(200059); // Audio dual mono mode menu
      }

      // SubTitle stream and/or files selection, show only when there exists any streams,
      //    dialog shows then the streams and an item to disable them
      if ((g_Player.ShowMenuItems & MenuItems.Subtitle) == MenuItems.Subtitle && g_Player.SubtitleStreams > 0 || g_Player.SupportsCC)
      {
        dlg.AddLocalizedString(462);
      }

      // If the decoder supports postprocessing features (FFDShow)
      if (g_Player.HasPostprocessing)
      {
        dlg.AddLocalizedString(200073);
      }

      dlg.AddLocalizedString(970); // Previous window
      if (g_Player.IsDVD)
      {
        if ((g_Player.ShowMenuItems & MenuItems.MainMenu) == MenuItems.MainMenu)
          dlg.AddLocalizedString(974); // Root menu
        if ((g_Player.ShowMenuItems & MenuItems.PopUpMenu) == MenuItems.PopUpMenu)
          dlg.AddLocalizedString(1700); // BD popup menu        
        if(!g_Player.HasChapters && (g_Player.ShowMenuItems & MenuItems.Chapter) == MenuItems.Chapter)
        {
          dlg.AddLocalizedString(975); // Previous chapter
          dlg.AddLocalizedString(976); // Next chapter
        }
      }

      if (g_Player.HasChapters && (g_Player.ShowMenuItems & MenuItems.Chapter) == MenuItems.Chapter) // For video files with chapters
      {
        dlg.AddLocalizedString(200091);
      }

      if (g_Player.IsVideo)
      {
        dlg.AddLocalizedString(1064); // Bookmarks
      }

      _IsDialogVisible = true;
      dlg.DoModal(GetID);
      _IsDialogVisible = false;

      if (dlg.SelectedId == -1)
      {
        return;
      }
      switch (dlg.SelectedId)
      {
          // Add audio stream selection to be able to switch audio streams in .ts recordings
        case 492:
          ShowAudioStreamsMenu();
          break;
        case 200059:
          ShowAudioDualMonoModeMenu(dualMonoMode);
          break;
        case 462:
          ShowSubtitleStreamsMenu();
          break;
        case 200073:
          ShowPostProcessingMenu();
          break;
        case 1064:
          ShowBookmarksMenu();
          break;
        case 974: // DVD root menu
          Action actionMenu = new Action(Action.ActionType.ACTION_DVD_MENU, 0, 0);
          GUIGraphicsContext.OnAction(actionMenu);
          break;
        case 1700: // BD popup menu
          Action actionPopupMenu = new Action(Action.ActionType.ACTION_BD_POPUP_MENU, 0, 0);
          GUIGraphicsContext.OnAction(actionPopupMenu);
          break;
        case 975: // DVD previous chapter
          Action actionPrevChapter = new Action(Action.ActionType.ACTION_PREV_CHAPTER, 0, 0);
          GUIGraphicsContext.OnAction(actionPrevChapter);
          break;
        case 976: // DVD next chapter
          Action actionNextChapter = new Action(Action.ActionType.ACTION_NEXT_CHAPTER, 0, 0);
          GUIGraphicsContext.OnAction(actionNextChapter);
          break;
        case 941: // Change aspect ratio
          ShowAspectRatioMenu();
          break;

        case 970:
          // switch back to MyMovies window
          _isOsdVisible = false;
          GUIWindowManager.IsOsdVisible = false;
          GUIGraphicsContext.IsFullScreenVideo = false;
          GUIWindowManager.ShowPreviousWindow();
          break;

        case 200090:
          ShowEditionStreamsMenu();
          break;

        case 200095:
          ShowVideoStreamsMenu();
          break;

        case 200091:
          ShowChapterStreamsMenu();
          break;
      }
    }
Exemplo n.º 9
0
        void ShowContextMenu()
        {
            if (dlg == null)
                dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);
            if (dlg == null) return;
            dlg.Reset();
            dlg.SetHeading(924); // menu

            if (!g_Player.IsTVRecording && GUIGraphicsContext.DBLClickAsRightClick)
            {
                dlg.AddLocalizedString(10104); // TV MiniEPG
            }

            dlg.AddLocalizedString(4); // TV Guide

            //TvBusinessLayer layer = new TvBusinessLayer();
            //IList linkages = layer.GetLinkagesForChannel(TVHome.Navigator.Channel);
            //if (linkages != null)
            //    if (linkages.Count > 0)
            //        dlg.AddLocalizedString(200042); // Linked Channels

            eAudioDualMonoMode dualMonoMode = g_Player.GetAudioDualMonoMode();

            if ((PluginMain.Navigator.IsLiveStreamOn && !PluginMain.Navigator.LastChannelChangeFailed) || g_Player.IsTVRecording)
            {
                if (!g_Player.IsTVRecording
                    && PluginMain.Navigator.HasTeletext())
                {
                    dlg.AddLocalizedString(1441); // Fullscreen teletext
                }

                dlg.AddLocalizedString(941); // Change aspect ratio

                if (g_Player.AudioStreams > 0)
                {
                    dlg.AddLocalizedString(492); // Audio language menu
                }

                if (dualMonoMode != eAudioDualMonoMode.UNSUPPORTED)
                {
                    dlg.AddLocalizedString(200059); // Audio dual mono mode menu
                }

                // SubTitle stream, show only when there exists any streams,
                //    dialog shows then the streams and an item to disable them
                if (g_Player.SubtitleStreams > 0 || g_Player.SupportsCC)
                {
                    dlg.AddLocalizedString(462);
                }

                // If the decoder supports postprocessing features (FFDShow)
                if (g_Player.HasPostprocessing)
                {
                    dlg.AddLocalizedString(200073);
                }

                dlg.AddLocalizedString(11000);  // Crop settings

                if (!g_Player.IsTVRecording)
                {
                    dlg.AddLocalizedString(100748); // Program Information
                }

                if (!g_Player.IsTVRecording && Utils.FileExistsInCache(GUIGraphicsContext.Skin + @"\ARGUS_TuningDetails.xml"))
                {
                    dlg.AddLocalizedString(200041); // tuning details
                }

                // TODO
                //if (!g_Player.IsTVRecording)
                //{
                //    dlg.AddLocalizedString(601);    //Record Now
                //}

                if (g_Player.HasChapters) // For recordings with chapters
                {
                    dlg.AddLocalizedString(200091);
                }

                if (!g_Player.IsTVRecording && Utils.FileExistsInCache(GUIGraphicsContext.Skin + @"\ARGUS_ChannelManagment.xml"))
                {
                    dlg.Add(Utility.GetLocalizedText(TextId.ChannelManager));
                }
            }
            //dlg.AddLocalizedString(368); // IMDB
            dlg.AddLocalizedString(970); // Previous window

            _isDialogVisible = true;

            dlg.DoModal(GetID);
            _isDialogVisible = false;

            Log.Debug("selected id:{0}", dlg.SelectedId);
            if (dlg.SelectedId == -1) return;

            if (dlg.SelectedLabelText == Utility.GetLocalizedText(TextId.ChannelManager))
            {
              GUIWindowManager.ActivateWindow(WindowId.ChannelManagment);
            }
            else
            {
              switch (dlg.SelectedId)
              {
                case 4: //TVGuide
                  {
                    GUIWindowManager.ActivateWindow(WindowId.TvGuide);
                    break;
                  }

                case 10104: // MiniEPG
                  {

                    Log.Debug("get miniguide");
                    MiniGuide miniGuide = (MiniGuide)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_MINI_GUIDE);
                    miniGuide.ChannelType = ChannelType.Television;
                    _isDialogVisible = true;
                    Log.Debug("show miniguide");
                    miniGuide.DoModal(GetID);
                    Log.Debug("done miniguide");
                    _isDialogVisible = false;
                    break;
                  }

                case 941: // Change aspect ratio
                  ShowAspectRatioMenu();
                  break;

                case 492: // Show audio language menu
                  ShowAudioLanguageMenu();
                  break;

                case 200059:
                  ShowAudioDualMonoModeMenu(dualMonoMode);
                  break;

                case 1441: // Fullscreen teletext
                  GUIWindowManager.ActivateWindow((int)GUIWindow.Window.WINDOW_FULLSCREEN_TELETEXT);
                  break;

                case 970:
                  // switch back to previous window
                  _isOsdVisible = false;
                  GUIWindowManager.IsOsdVisible = false;
                  GUIGraphicsContext.IsFullScreenVideo = false;
                  GUIWindowManager.ShowPreviousWindow();
                  break;

                case 11000:
                  TvCropSettings cropSettings = (TvCropSettings)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_TV_CROP_SETTINGS);
                  _isDialogVisible = true;
                  cropSettings.DoModal(GetID);
                  _isDialogVisible = false;
                  break;

                case 100748: // Show Program Info
                  ShowProgramInfo();
                  break;

                case 601: // RecordNow
                  GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_RECORD, GUIWindowManager.ActiveWindow, 0, 0, 0, 0, null);
                  this.OnMessage(msg);
                  break;

                //case 200042: // Linked channels
                //    Gentle.Common.CacheManager.Clear();
                //    linkages = layer.GetLinkagesForChannel(TVHome.Navigator.Channel);
                //    ShowLinkedChannelsMenu(linkages);
                //    break;

                case 200041: // tuning details
                  GUIWindowManager.ActivateWindow((int)GUIWindow.Window.WINDOW_TV_TUNING_DETAILS);
                  break;

                case 200091:
                  ShowChapterStreamsMenu();
                  break;

                case 462:
                  ShowSubtitleStreamsMenu();
                  break;

                case 200073:
                  ShowPostProcessingMenu();
                  break;
              }
            }
        }
Exemplo n.º 10
0
    private void Dialog_ProtectedContent(GUIDialogMenu dlg)
    {
      if (pins.Count > 0)
      {
        dlg.Reset();
        dlg.SetHeading(498); // menu

        if (ageConfirmed)
        {
          dlg.AddLocalizedString(1240); //Lock content
        }
        else
        {
          dlg.AddLocalizedString(1241); //Unlock content
        }
      }
      // Show menu
      dlg.DoModal(GetID);
      if (dlg.SelectedId == -1)
      {
        return;
      }
      switch (dlg.SelectedId)
      {
        case 1240: //Lock content
        case 1241: //Unlock content
          OnContentLock();
          break;
      }
    }
Exemplo n.º 11
0
    private void ShowChapterStreamsMenu()
    {
      if (dlg == null)
      {
        dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU);
      }
      if (dlg == null)
      {
        return;
      }
      dlg.Reset();
      dlg.SetHeading(200091); // Chapters Streams

      // Previous chapter
      dlg.Add(String.Format("{0}", GUILocalizeStrings.Get(975)));
      // Next chapter
      dlg.Add(String.Format("{0}", GUILocalizeStrings.Get(976)));

      //List all chapters
      double[] chaptersList = new double[0];
      //List all chapters Name
      string[] chaptersname = new string[0];

      chaptersname = g_Player.ChaptersName;
      chaptersList = g_Player.Chapters;
      for (int i = 0; i < chaptersList.Length; i++)
      {
        GUIListItem item = new GUIListItem();
        if (chaptersname == null)
        {
          item.Label = (String.Format("{0} #{1}", GUILocalizeStrings.Get(200091), (i + 1)));
          item.Label2 = MediaPortal.Util.Utils.SecondsToHMSString((int)chaptersList[i]);
          dlg.Add(item);
        }
        else
        {
          if (string.IsNullOrEmpty(chaptersname[i]))
          {
            item.Label = (String.Format("{0} #{1}", GUILocalizeStrings.Get(200091), (i + 1)));
            item.Label2 = MediaPortal.Util.Utils.SecondsToHMSString((int)chaptersList[i]);
            dlg.Add(item);
          }
          else
          {
            item.Label = (String.Format("{0} #{1}: {2}", GUILocalizeStrings.Get(200091), (i + 1), chaptersname[i]));
            item.Label2 = MediaPortal.Util.Utils.SecondsToHMSString((int)chaptersList[i]);
            dlg.Add(item);
          }
        }
      }

      // show dialog and wait for result
      _isDialogVisible = true;
      dlg.DoModal(GetID);
      _isDialogVisible = false;

      if (dlg.SelectedId == -1)
      {
        return;
      }
      else if (dlg.SelectedLabel == 0)
      {
        Action actionPrevChapter = new Action(Action.ActionType.ACTION_PREV_CHAPTER, 0, 0);
        GUIGraphicsContext.OnAction(actionPrevChapter);
      }
      else if (dlg.SelectedLabel == 1)
      {
        Action actionNextChapter = new Action(Action.ActionType.ACTION_NEXT_CHAPTER, 0, 0);
        GUIGraphicsContext.OnAction(actionNextChapter);
      }
      else
      {
        // get selected Chapters
        int selectedChapterIndex = dlg.SelectedLabel - 2;

        // set mplayers play position
        g_Player.SeekAbsolute(chaptersList[selectedChapterIndex]);
      }
    }
Exemplo n.º 12
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;
 }
Exemplo n.º 13
0
        public DialogResult ShowDialogSelect(IEnumerable<GUIListItem> listLabels, bool addCustomButton)
        {
            _dlgSelect = BuildDialogSelect(listLabels);
            GUIListItem customButton = new GUIListItem("Set Custom Status...");
            if (addCustomButton) {
                _dlgSelect.Add(customButton);
            }
            _dlgSelect.DoModal(GUIWindowManager.ActiveWindow);

            DialogResult result = new DialogResult(_dlgSelect.SelectedLabel, _dlgSelect.SelectedLabelText, _dlgSelect.SelectedLabelText);
            _dlgSelect.ResetAllControls();
            _dlgSelect.Reset();
            if (result.selectedLabelText == "Set Custom Status...") {
                result = ShowDialogSelect(listLabels, false);
                result.message = GetKeyBoardInput(result.selectedLabelText);
            }
            return result;
        }
Exemplo n.º 14
0
        public void ManualSelect3DFormat(VideoFormat preSelected)
        {
            _dlgMenu = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);

              if (_dlgMenu != null)
              {
            _dlgMenu.Reset();
            _dlgMenu.SetHeading("Select 2D/3D Format for TV");

            if (preSelected == VideoFormat.Fmt2D)
              _dlgMenu.Add("2D");

            if (preSelected == VideoFormat.Fmt2D || preSelected == VideoFormat.Fmt3DSBS)
            {
              _dlgMenu.Add("3D Side by Side");
              _dlgMenu.Add("3D SBS -> 2D via MediaPortal");
            }

            if (preSelected == VideoFormat.Fmt2D || preSelected == VideoFormat.Fmt3DTAB)
            {
              _dlgMenu.Add("3D Top and Bottom");
              _dlgMenu.Add("3D TAB -> 2D via MediaPortal");
            }

            if (bConvert2Dto3DEnabled && preSelected == VideoFormat.Fmt2D)
            {
            _dlgMenu.Add("2D -> 3D SBS via MediaPortal");
            }

            if (_currentMode == VideoFormat.Fmt3DSBS || _currentMode == VideoFormat.Fmt3DTAB)
            {
              if (!GUIGraphicsContext.Switch3DSides)
            _dlgMenu.Add("3D Reverse Mode");
              else
            _dlgMenu.Add("3D Normal Mode");
            }

            if (_activeDevice.IsDefined(VideoFormat.Fmt2D3D))
              _dlgMenu.Add("2D -> 3D via TV");

            _dlgMenu.DoModal((int)GUIWindow.Window.WINDOW_FULLSCREEN_VIDEO);

            Log.Info("Auto3D: Manually selected " + _dlgMenu.SelectedLabelText);

            switch (_dlgMenu.SelectedLabelText)
            {
              case "2D":

            _activeDevice.SwitchFormat(_currentMode, VideoFormat.Fmt2D);
            GUIGraphicsContext.Render3DMode = GUIGraphicsContext.eRender3DMode.None;
            _currentMode = VideoFormat.Fmt2D;
            break;

              case "3D Side by Side":

            _activeDevice.SwitchFormat(_currentMode, VideoFormat.Fmt3DSBS);
            GUIGraphicsContext.Render3DMode = GUIGraphicsContext.eRender3DMode.SideBySide;
            _currentMode = VideoFormat.Fmt3DSBS;
            break;

              case "3D Top and Bottom":

            _activeDevice.SwitchFormat(_currentMode, VideoFormat.Fmt3DTAB);
            GUIGraphicsContext.Render3DMode = GUIGraphicsContext.eRender3DMode.TopAndBottom;
            _currentMode = VideoFormat.Fmt3DTAB;
            break;

              case "2D -> 3D via TV":

            _activeDevice.SwitchFormat(_currentMode, VideoFormat.Fmt2D3D);
            GUIGraphicsContext.Render3DMode = GUIGraphicsContext.eRender3DMode.None;
            _currentMode = VideoFormat.Fmt2D3D;
            break;

              case "3D SBS -> 2D via MediaPortal":

            _activeDevice.SwitchFormat(_currentMode, VideoFormat.Fmt2D);
            GUIGraphicsContext.Render3DMode = GUIGraphicsContext.eRender3DMode.SideBySideTo2D;
            _currentMode = VideoFormat.Fmt2D;
            break;

              case "3D TAB -> 2D via MediaPortal":

            _activeDevice.SwitchFormat(_currentMode, VideoFormat.Fmt2D);
            GUIGraphicsContext.Render3DMode = GUIGraphicsContext.eRender3DMode.TopAndBottomTo2D;
            _currentMode = VideoFormat.Fmt2D;
            break;

              case "3D Reverse Mode":

            GUIGraphicsContext.Switch3DSides = true;
            break;

              case "3D Normal Mode":

            GUIGraphicsContext.Switch3DSides = false;
            break;

              case "2D -> 3D SBS via MediaPortal":

            _activeDevice.SwitchFormat(_currentMode, VideoFormat.Fmt3DSBS);
            GUIGraphicsContext.Render3DMode = GUIGraphicsContext.eRender3DMode.SideBySideFrom2D;
            _currentMode = VideoFormat.Fmt3DSBS;
            break;
            }

            _dlgMenu = null;
              }
        }
Exemplo n.º 15
0
    private void DialogProtectedContent(GUIDialogMenu dlg)
    {
      dlg.Reset();
      dlg.SetHeading(498); // menu

      if (_protectedShares.Count > 0)
      {
        if (_ageConfirmed)
        {
          dlg.AddLocalizedString(1240); //Lock content
        }
        else
        {
          dlg.AddLocalizedString(1241); //Unlock content
        }
      }

      dlg.AddLocalizedString(926); //add to playlist

      if (handler.CurrentLevelWhere == "actor" && facadeLayout.Count > 1)
      {
        dlg.AddLocalizedString(1295); //Search actor
      }

      if (handler.CurrentLevelWhere == "director" && facadeLayout.Count > 1)
      {
        dlg.AddLocalizedString(1268); // Search director
      }
      else if ((handler.CurrentLevelWhere == "title" ||
                handler.CurrentLevelWhere == "recently added" ||
                handler.CurrentLevelWhere == "recently watched") && facadeLayout.Count > 1 ||
                handler.CurrentLevelWhere == "user groups")
      {
        dlg.AddLocalizedString(1293); //Search movie

        if (handler.CurrentLevelWhere == "user groups")
        {
          dlg.AddLocalizedString(1272); //Add usergroup
          dlg.AddLocalizedString(1273); //Remove selected usergroup
        }
      }

      dlg.AddLocalizedString(1262); // Update grabber scripts
      dlg.AddLocalizedString(1307); // Update internal grabber scripts
      dlg.AddLocalizedString(1263); // Set default grabber
      // Show menu
      dlg.DoModal(GetID);

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

      switch (dlg.SelectedId)
      {
        case 926: //add to playlist
          OnQueueItem(facadeLayout.SelectedListItemIndex);
          break;
        case 1240: //Lock content
        case 1241: //Unlock content
          OnContentLock();
          break;
        case 1293: //Search movie
          OnSearchMovie();
          break;
        case 1295: //Search actor
        case 1268: // Search director
          OnSearchActor();
          break;
        case 1263: // Set deault grabber script
          GUIVideoFiles.SetDefaultGrabber();
          break;
        case 1262: // Update grabber scripts
          GUIVideoFiles.UpdateGrabberScripts(false);
          break;
        case 1307: // Update internal grabber scripts
          GUIVideoFiles.UpdateGrabberScripts(true);
          break;
        case 1272: // Add user group
          OnAddUserGroup();
          break;
        case 1273: // Remove user group
          GUIListItem item = facadeLayout.SelectedListItem;

          if (item == null)
          {
            return;
          }

          OnRemoveUserGroup(item.Label);
          break;
        
      }
    }
Exemplo n.º 16
0
    private void ShowContextMenu()
    {
      if (dlg == null)
      {
        dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU);
      }
      if (dlg == null)
      {
        return;
      }
      dlg.Reset();
      dlg.SetHeading(924); // menu

      if (!g_Player.IsTVRecording && GUIGraphicsContext.DBLClickAsRightClick)
      {
        dlg.AddLocalizedString(10104); // TV MiniEPG
      }

      //dlg.AddLocalizedString(915); // TV Channels
      if (!g_Player.IsTVRecording)
      {
        dlg.AddLocalizedString(4); // TV Guide}
      }

      TvBusinessLayer layer = new TvBusinessLayer();
      IList<ChannelLinkageMap> linkages = null;
      if (!g_Player.IsTVRecording)
      {
        linkages = layer.GetLinkagesForChannel(TVHome.Navigator.Channel);
        if (linkages != null)
        {
          if (linkages.Count > 0)
          {
            dlg.AddLocalizedString(200042); // Linked Channels
          }
        }
      }

    /*if (TVHome.Navigator.Groups.Count > 1)
        dlg.AddLocalizedString(971); // Group*/
      if (!g_Player.IsTVRecording && TVHome.Card.HasTeletext)
      {
        dlg.AddLocalizedString(1441); // Fullscreen teletext
      }
      dlg.AddLocalizedString(941); // Change aspect ratio

      // msn related can be removed
      //if (PluginManager.IsPluginNameEnabled("MSN Messenger"))
      //{
      //  dlg.AddLocalizedString(12902); // MSN Messenger
      //  dlg.AddLocalizedString(902); // MSN Online contacts
      //}

      //IAudioStream[] streams = TVHome.Card.AvailableAudioStreams;
      //if (streams != null && streams.Length > 0)
      if (g_Player.AudioStreams > 0)
      {
        dlg.AddLocalizedString(492); // Audio language menu
      }

      eAudioDualMonoMode dualMonoMode = g_Player.GetAudioDualMonoMode();
      if (dualMonoMode != eAudioDualMonoMode.UNSUPPORTED)
      {
        dlg.AddLocalizedString(200059); // Audio dual mono mode menu
      }

      // SubTitle stream, show only when there exists any streams,
      //    dialog shows then the streams and an item to disable them
      if (g_Player.SubtitleStreams > 0 || g_Player.SupportsCC)
      {
        dlg.AddLocalizedString(462);
      }

      // If the decoder supports postprocessing features (FFDShow)
      if (g_Player.HasPostprocessing)
      {
        dlg.AddLocalizedString(200073);
      }

      dlg.AddLocalizedString(11000); // Crop settings

      if (!g_Player.IsTVRecording)
      {
        dlg.AddLocalizedString(100748); // Program Information
      }

      if (!g_Player.IsTVRecording && Utils.FileExistsInCache(GUIGraphicsContext.Skin + @"\mytvtuningdetails.xml"))
      {
        dlg.AddLocalizedString(200041); // tuning details
      }

      TvServer server = new TvServer();
      if (!g_Player.IsTVRecording)
      {
        VirtualCard vc;
        if (server.IsRecording(TVHome.Navigator.Channel.IdChannel, out vc))
        {
          dlg.AddLocalizedString(265); //stop rec.
        }
        else
        {
          dlg.AddLocalizedString(601); //Record Now        
        }
      }

      if (TVHome.Card.CiMenuSupported() && !g_Player.IsTVRecording)
        dlg.AddLocalizedString(2700); // CI Menu supported

      //dlg.AddLocalizedString(6008); // Sort TvChannel

      if (!g_Player.IsTVRecording && TVHome.Card.IsOwner() && !TVHome.Card.IsRecording &&
          TVHome.Card.SupportsQualityControl())
      {
        dlg.AddLocalizedString(882);
      }

      if (g_Player.HasChapters) // For recordings with chapters
      {
        dlg.AddLocalizedString(200091);
      }
      dlg.AddLocalizedString(368); // IMDB
      dlg.AddLocalizedString(970); // Previous window

      _isDialogVisible = true;

      dlg.DoModal(GetID);
      _isDialogVisible = false;

      Log.Debug("selected id:{0}", dlg.SelectedId);
      if (dlg.SelectedId == -1)
      {
        return;
      }
      switch (dlg.SelectedId)
      {
        case 4: // TVGuide
          {
            TvNewScheduleSearch.SearchFor = TvNewScheduleSearch.SearchType.KeyWord;
            GUIWindowManager.ActivateWindow((int)Window.WINDOW_TVGUIDE);
            break;
          }

        case 10104: // MiniEPG
          {
            ShowMiniEpg();
            break;
          }

        case 941: // Change aspect ratio
          ShowAspectRatioMenu();
          break;

        case 2700: // Open CI Menu
          PrepareCiMenu();
          break;

        //case 6008: // TvChannel sort
        //  SortChannels();
        //  break;

        case 492: // Show audio language menu
          ShowAudioLanguageMenu();
          break;

        case 200059:
          ShowAudioDualMonoModeMenu(dualMonoMode);
          break;

        case 1441: // Fullscreen teletext
          GUIWindowManager.ActivateWindow((int)Window.WINDOW_FULLSCREEN_TELETEXT);
          break;

        case 970:
          // switch back to previous window
          _isOsdVisible = false;
          GUIWindowManager.IsOsdVisible = false;
          GUIGraphicsContext.IsFullScreenVideo = false;
          GUIWindowManager.ShowPreviousWindow();
          break;

        case 11000:
          TvCropSettings cropSettings =
            (TvCropSettings)GUIWindowManager.GetWindow((int)Window.WINDOW_TV_CROP_SETTINGS);
          _isDialogVisible = true;
          cropSettings.DoModal(GetID);
          _isDialogVisible = false;
          break;

        case 100748: // Show Program Info
          ShowProgramInfo();
          break;

        case 601: // RecordNow          
        case 265: // StopRec.          
          TVHome.ManualRecord(TVHome.Navigator.Channel, GetID);
          break;

        case 200042: // Linked channels
          CacheManager.Clear();
          linkages = layer.GetLinkagesForChannel(TVHome.Navigator.Channel);
          ShowLinkedChannelsMenu(linkages);
          break;

        case 200041: // Tuning details
          GUIWindowManager.ActivateWindow((int)Window.WINDOW_TV_TUNING_DETAILS);
          break;

        case 882: // Quality settings
          ShowQualitySettingsMenu();
          break;

        case 368: // IMDB
          OnGetIMDBInfo();
          break;

        case 200091:
          ShowChapterStreamsMenu();
          break;

        case 462:
          ShowSubtitleStreamsMenu();
          break;

        case 200073:
          ShowPostProcessingMenu();
          break;
      }
    }
Exemplo n.º 17
0
        public override bool OnMessage(GUIMessage message)
        {
            _needToClearScreen = true;

            #region case GUI_MSG_RECORD

            if (message.Message == GUIMessage.MessageType.GUI_MSG_RECORD)
            {
                if (_isDialogVisible)
                {
                    return false;
                }

                Channel currentChannel = PluginMain.Navigator.CurrentChannel;
                GuideProgram currentProgram = PluginMain.GetCurrentProgram(ChannelType.Television);
                if (currentChannel != null)
                {
                    ActiveRecording activeRecording;
                    if (currentProgram == null
                        || !PluginMain.IsActiveRecording(currentChannel.ChannelId, currentProgram, out activeRecording))
                    {
                        PluginMain.IsChannelRecording(currentChannel.ChannelId, out activeRecording);
                    }
                    if (activeRecording != null)
                    {
                        _dlgYesNo = (GUIDialogYesNo)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_YES_NO);
                        _dlgYesNo.SetHeading(1449); // stop recording
                        _dlgYesNo.SetLine(1, 1450); // are you sure to stop recording?
                        _dlgYesNo.SetLine(2, activeRecording.Program.Title);
                        _dialogYesNoVisible = true;
                        _dlgYesNo.DoModal(GetID);
                        _dialogYesNoVisible = false;

                        if (_dlgYesNo.IsConfirmed)
                        {
                            using (SchedulerServiceAgent tvSchedulerAgent = new SchedulerServiceAgent())
                            {
                                Schedule schedule = tvSchedulerAgent.GetScheduleById(activeRecording.Program.ScheduleId);
                                if (schedule != null)
                                {
                                    if (activeRecording.Program.IsPartOfSeries)
                                    {
                                        tvSchedulerAgent.CancelUpcomingProgram(schedule.ScheduleId,
                                            currentProgram == null ? null : (Guid?)currentProgram.GuideProgramId,
                                            currentChannel.ChannelId, activeRecording.Program.StartTime);
                                    }
                                    else
                                    {
                                        tvSchedulerAgent.DeleteSchedule(schedule.ScheduleId);
                                    }
                                    string text = String.Format("{0} {1}-{2}",
                                          activeRecording.Program.Title,
                                          activeRecording.Program.StartTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat),
                                          activeRecording.Program.StopTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat));
                                    ShowRecordingNotifyDialog(tvSchedulerAgent, currentChannel, text, TextId.RecordingStopped);
                                }
                            }
                        }
                    }
                    else
                    {
                        _dialogMenu = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);
                        if (_dialogMenu != null)
                        {
                            using (SchedulerServiceAgent tvSchedulerAgent = new SchedulerServiceAgent())
                            {
                                _dialogMenu.Reset();
                                _dialogMenu.SetHeading(Utility.GetLocalizedText(TextId.Record));
                                if (currentProgram != null)
                                {
                                    _dialogMenu.Add(Utility.GetLocalizedText(TextId.CurrentProgram));
                                }
                                _dialogMenu.Add("15 " + Utility.GetLocalizedText(TextId.Minutes));
                                _dialogMenu.Add("30 " + Utility.GetLocalizedText(TextId.Minutes));
                                _dialogMenu.Add("1 " + Utility.GetLocalizedText(TextId.Hour));
                                _dialogMenu.Add("1 " + Utility.GetLocalizedText(TextId.Hour) + " 30 " + Utility.GetLocalizedText(TextId.Minutes));
                                _dialogMenu.Add("2 " + Utility.GetLocalizedText(TextId.Hours));
                                _bottomDialogMenuVisible = true;

                                _dialogMenu.DoModal(GetID);

                                _bottomDialogMenuVisible = false;

                                Schedule schedule = null;
                                string notifyText = String.Empty;

                                int selectedLabel = _dialogMenu.SelectedLabel;
                                if (currentProgram == null)
                                {
                                    selectedLabel++;
                                }
                                switch (selectedLabel)
                                {
                                    case 0:
                                        schedule = GuideController.CreateRecordOnceSchedule(tvSchedulerAgent,
                                            PluginMain.Navigator.CurrentChannel.ChannelType,
                                            PluginMain.Navigator.CurrentChannel.ChannelId, currentProgram.Title, currentProgram.SubTitle,
                                            currentProgram.EpisodeNumberDisplay, currentProgram.StartTime);
                                        notifyText = String.Format("{0} {1}-{2}",
                                              currentProgram.Title,
                                              currentProgram.StartTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat),
                                              currentProgram.StopTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat));
                                        break;

                                    case 1:
                                        schedule = CreateManualSchedule(currentChannel, 15, out notifyText);
                                        break;

                                    case 2:
                                        schedule = CreateManualSchedule(currentChannel, 30, out notifyText);
                                        break;

                                    case 3:
                                        schedule = CreateManualSchedule(currentChannel, 60, out notifyText);
                                        break;

                                    case 4:
                                        schedule = CreateManualSchedule(currentChannel, 90, out notifyText);
                                        break;

                                    case 5:
                                        schedule = CreateManualSchedule(currentChannel, 2 * 60, out notifyText);
                                        break;
                                }

                                if (schedule != null)
                                {
                                    tvSchedulerAgent.SaveSchedule(schedule);
                                    ShowRecordingNotifyDialog(tvSchedulerAgent, currentChannel, notifyText, TextId.RecordingStarted);
                                }
                            }
                        }
                    }
                }
                return true;
            }

            #endregion

            #region case GUI_MSG_RECORDER_ABOUT_TO_START_RECORDING

            if (message.Message == GUIMessage.MessageType.GUI_MSG_RECORDER_ABOUT_TO_START_RECORDING)
            {
                /*
                        TVRecording rec = message.Object as TVRecording;
                        if (rec == null) return true;
                        if (rec.Channel == Recorder.TVChannelName) return true;
                        if (!Recorder.NeedChannelSwitchForRecording(rec)) return true;

                        _messageBoxVisible = false;
                        _msnWindowVisible = false;     // msn related can be removed
                        GUIWindowManager.IsOsdVisible = false;
                        if (_zapOsdVisible)
                        {
                          GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_WINDOW_DEINIT, _zapWindow.GetID, 0, 0, GetID, 0, null);
                          _zapWindow.OnMessage(msg);
                          _zapOsdVisible = false;
                          GUIWindowManager.IsOsdVisible = false;
                        }
                        if (_isOsdVisible)
                        {
                          GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_WINDOW_DEINIT, _osdWindow.GetID, 0, 0, GetID, 0, null);
                          _osdWindow.OnMessage(msg);
                          _isOsdVisible = false;
                          GUIWindowManager.IsOsdVisible = false;
                        }
                        if (_msnWindowVisible)     // msn related can be removed
                        {
                          GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_WINDOW_DEINIT, _msnWindow.GetID, 0, 0, GetID, 0, null);
                          _msnWindow.OnMessage(msg);	// Send a de-init msg to the OSD
                          _msnWindowVisible = false;
                          GUIWindowManager.IsOsdVisible = false;
                        }
                        if (_isDialogVisible && dlg != null)
                        {
                          GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_WINDOW_DEINIT, dlg.GetID, 0, 0, GetID, 0, null);
                          dlg.OnMessage(msg);	// Send a de-init msg to the OSD
                        }

                        _bottomDialogMenuVisible = true;
                        _dialogBottomMenu = (GUIDialogMenuBottomRight)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU_BOTTOM_RIGHT);
                        _dialogBottomMenu.TimeOut = 10;
                        _dialogBottomMenu.SetHeading(1004);//About to start recording
                        _dialogBottomMenu.SetHeadingRow2(String.Format("{0} {1}", GUILocalizeStrings.Get(1005), rec.Channel));
                        _dialogBottomMenu.SetHeadingRow3(rec.Title);
                        _dialogBottomMenu.AddLocalizedString(1006); //Allow recording to begin
                        _dialogBottomMenu.AddLocalizedString(1007); //Cancel recording and maintain watching tv
                        _dialogBottomMenu.DoModal(GetID);
                        if (_dialogBottomMenu.SelectedId == 1007) //cancel recording
                        {
                          if (rec.RecType == TVRecording.RecordingType.Once)
                          {
                            rec.Canceled = Utils.datetolong(DateTime.Now);
                          }
                          else
                          {
                            Program prog = message.Object2 as Program;
                            if (prog != null)
                              rec.CanceledSeries.Add(prog.Start);
                            else
                              rec.CanceledSeries.Add(Utils.datetolong(DateTime.Now));
                          }
                          TVDatabase.UpdateRecording(rec, TVDatabase.RecordingChange.Canceled);
                        }
                 */
                _bottomDialogMenuVisible = false;
            }

            #endregion

            #region case GUI_MSG_NOTIFY

            if (message.Message == GUIMessage.MessageType.GUI_MSG_NOTIFY)
            {
                GUIDialogNotify dlgNotify = (GUIDialogNotify)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_NOTIFY);
                if (dlgNotify == null)
                {
                    return true;
                }
                string channel = GUIPropertyManager.GetProperty("#TV.View.channel");
                string strLogo = Utils.GetCoverArt(Thumbs.TVChannel, channel);
                dlgNotify.Reset();
                dlgNotify.ClearAll();
                dlgNotify.SetImage(strLogo);
                dlgNotify.SetHeading(channel);
                dlgNotify.SetText(message.Label);
                dlgNotify.TimeOut = message.Param1;
                _notifyDialogVisible = true;
                dlgNotify.DoModal(GUIWindowManager.ActiveWindow);
                _notifyDialogVisible = false;
                Log.Debug("Notify Message:" + channel + ", " + message.Label);
                return true;
            }

            #endregion

            #region case GUI_MSG_TV_ERROR_NOTIFY

            // TEST for TV error handling
            if (message.Message == GUIMessage.MessageType.GUI_MSG_TV_ERROR_NOTIFY)
            {
                UpdateOSD(message.Object);
                return true;
            }

            #endregion

            #region case GUI_MSG_WINDOW_DEINIT

            if (_isOsdVisible)
            {
                if ((message.Message != GUIMessage.MessageType.GUI_MSG_WINDOW_DEINIT))
                {
                    _osdTimeoutTimer = DateTime.Now;
                    // route messages to OSD window
                    if (_osdWindow.OnMessage(message))
                    {
                        return true;
                    }
                }
                else if (message.Param1 == GetID)
                {
                    _osdTimeoutTimer = DateTime.Now;
                    _osdWindow.OnMessage(message);
                }
            }

            #endregion

            switch (message.Message)
            {
                #region case GUI_MSG_HIDE_MESSAGE

                case GUIMessage.MessageType.GUI_MSG_HIDE_MESSAGE:
                    {
                        _messageBoxVisible = false;
                    }
                    break;

                #endregion

                #region case GUI_MSG_SHOW_MESSAGE

                case GUIMessage.MessageType.GUI_MSG_SHOW_MESSAGE:
                    {
                        GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_LABEL_SET, GetID, 0,
                                                        (int)Control.MSG_BOX_LABEL1, 0, 0, null);
                        msg.Label = message.Label;
                        OnMessage(msg);

                        msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_LABEL_SET, GetID, 0, (int)Control.MSG_BOX_LABEL2, 0, 0,
                                             null);
                        msg.Label = message.Label2;
                        OnMessage(msg);

                        msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_LABEL_SET, GetID, 0, (int)Control.MSG_BOX_LABEL3, 0, 0,
                                             null);
                        msg.Label = message.Label3;
                        OnMessage(msg);

                        msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_LABEL_SET, GetID, 0, (int)Control.MSG_BOX_LABEL4, 0, 0,
                                             null);
                        msg.Label = message.Label4;
                        OnMessage(msg);

                        _messageBoxVisible = true;
                        // Set specified timeout
                        _msgBoxTimeout = message.Param1;
                        _msgTimer = DateTime.Now;
                    }
                    break;

                #endregion

                #region case GUI_MSG_WINDOW_DEINIT

                case GUIMessage.MessageType.GUI_MSG_WINDOW_DEINIT:
                    {
                        lock (this)
                        {
                            Log.Debug("TvFullScreen:deinit->OSD:Off");
                            HideMainOSD();

                            _isOsdVisible = false;
                            _isPauseOsdVisible = false;
                            GUIWindowManager.IsOsdVisible = false;
                            GUIWindowManager.IsPauseOsdVisible = false;
                            _channelInputVisible = false;
                            _keyPressedTimer = DateTime.Now;
                            _channelName = "";

                            _stepSeekVisible = false;
                            _statusVisible = false;
                            //_groupVisible = false;
                            _notifyDialogVisible = false;
                            _dialogYesNoVisible = false;
                            _bottomDialogMenuVisible = false;
                            _statusTimeOutTimer = DateTime.Now;

                            _screenState.ContextMenuVisible = false;
                            _screenState.MsgBoxVisible = false;
                            _screenState.OsdVisible = false;
                            _screenState.Paused = false;
                            _screenState.ShowGroup = false;
                            _screenState.ShowInput = false;
                            _screenState.ShowStatusLine = false;
                            _screenState.ShowTime = false;
                            _screenState.ZapOsdVisible = false;
                            _needToClearScreen = false;

                            GUIGraphicsContext.IsFullScreenVideo = false;
                            GUILayerManager.UnRegisterLayer(this);

                            base.OnMessage(message);
                        }
                        return true;
                    }

                #endregion

                #region case GUI_MSG_WINDOW_INIT

                case GUIMessage.MessageType.GUI_MSG_WINDOW_INIT:
                    {
                        base.OnMessage(message);
                        if (!SettingsLoaded)
                            LoadSettings();
                        GUIGraphicsContext.IsFullScreenVideo = true;

                        _osdWindow = (TvOsd)GUIWindowManager.GetWindow((int)Window.WINDOW_TVOSD);
                        _zapWindow = (TvZapOsd)GUIWindowManager.GetWindow((int)Window.WINDOW_TVZAPOSD);

                        _lastPause = g_Player.Paused;
                        _lastSpeed = g_Player.Speed;

                        Log.Debug("TvFullScreen:init->OSD:Off");
                        Log.Debug("TvFullScreen: init, playing {0}, player.CurrentFile {1}", g_Player.Playing, g_Player.CurrentFile);

                        _isOsdVisible = false;
                        GUIWindowManager.IsOsdVisible = false;
                        _channelInputVisible = false;
                        _keyPressedTimer = DateTime.Now;
                        _channelName = "";

                        _isPauseOsdVisible = _lastPause;
                        GUIWindowManager.IsPauseOsdVisible = _lastPause;
                        //_zapTimeOutTimer=DateTime.Now;
                        _osdTimeoutTimer = DateTime.Now;

                        _stepSeekVisible = false;
                        _statusVisible = false;
                        //_groupVisible = false;
                        _notifyDialogVisible = false;
                        _dialogYesNoVisible = false;
                        _bottomDialogMenuVisible = false;
                        _statusTimeOutTimer = DateTime.Now;
                        //imgVolumeBar.Current = VolumeHandler.Instance.Step;
                        //imgVolumeBar.Maximum = VolumeHandler.Instance.StepMax;

                        ResetAllControls(); // make sure the controls are positioned relevant to the OSD Y offset
                        ScreenStateChanged();
                        UpdateGUI();

                        GUIGraphicsContext.IsFullScreenVideo = true;
                        GUILayerManager.RegisterLayer(this, GUILayerManager.LayerType.Osd);

                        RenderVolume(false);

                        //return base.OnMessage(message);
                        return true;
                    }

                #endregion

                #region case GUI_MSG_SETFOCUS

                case GUIMessage.MessageType.GUI_MSG_SETFOCUS:
                    goto case GUIMessage.MessageType.GUI_MSG_LOSTFOCUS;

                #endregion

                #region case GUI_MSG_LOSTFOCUS

                case GUIMessage.MessageType.GUI_MSG_LOSTFOCUS:
                    if (_isOsdVisible)
                    {
                        return true;
                    }
                    if (message.SenderControlId != (int)GUIWindow.Window.WINDOW_TVFULLSCREEN)
                    {
                        return true;
                    }
                    break;

                #endregion
            }
            return base.OnMessage(message);
        }
Exemplo n.º 18
0
        public void ShowFileMenu(GUIListItem item)
        {
            m_bReload = false;
            int iPincodeCorrect;

            if (item == null)
            {
                return;
            }
            if (item.IsFolder && item.Label == "..")
            {
                return;
            }
            if (m_directory.IsProtectedShare(item.Path, out iPincodeCorrect))
            {
                ShowErrorDialog(513, item.Path);
                Close();
                return;
            }
            if (m_preselectDelete)
            {
                OnDeleteItem(item);
                return;
            }

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

            if (dlg == null)
            {
                return;
            }
            dlg.Reset();
            dlg.SetHeading(500); // File menu

            sourceFolder = Path.GetDirectoryName(item.Path);
            if ((destinationFolder != "") && (destinationFolder != sourceFolder))
            {
                dlg.AddLocalizedString(115); //copy
                if (!Util.Utils.IsDVD(item.Path))
                {
                    dlg.AddLocalizedString(116); //move
                }
            }
            if (!Util.Utils.IsDVD(item.Path))
            {
                dlg.AddLocalizedString(118); //rename
            }
            if (!Util.Utils.IsDVD(item.Path))
            {
                dlg.AddLocalizedString(117); //delete
            }
            if (!Util.Utils.IsDVD(item.Path))
            {
                dlg.AddLocalizedString(119); //new folder
            }

            if (item.IsFolder && !Util.Utils.IsDVD(item.Path))
            {
                dlg.AddLocalizedString(501); // Set as destination
            }
            if (destinationFolder != "")
            {
                dlg.AddLocalizedString(504); // Goto destination
            }

            dlg.DoModal(m_dwParentWindowID);
            if (dlg.SelectedId == -1)
            {
                return;
            }
            switch (dlg.SelectedId)
            {
            case 117: // delete
                OnDeleteItem(item);
                break;

            case 118: // rename
            {
                string strSourceName = "";
                string strExtension  = Path.GetExtension(item.Path);

                if (item.IsFolder && !VirtualDirectory.IsImageFile(strExtension))
                {
                    strSourceName = Path.GetFileName(item.Path);
                }
                else
                {
                    strSourceName = Path.GetFileNameWithoutExtension(item.Path);
                }

                string strDestinationName = strSourceName;

                if (GetUserInputString(ref strDestinationName) == true)
                {
                    if (item.IsFolder && !VirtualDirectory.IsImageFile(strExtension))
                    {
                        // directory rename
                        if (Directory.Exists(sourceFolder + "\\" + strSourceName))
                        {
                            try
                            {
                                Directory.Move(sourceFolder + "\\" + strSourceName, sourceFolder + "\\" + strDestinationName);
                            }
                            catch (Exception)
                            {
                                ShowErrorDialog(dlg.SelectedId, sourceFolder + "\\" + strSourceName);
                            }
                            m_bReload = true;
                        }
                    }
                    else
                    {
                        // file rename
                        if (File.Exists(item.Path))
                        {
                            string strDestinationFile = sourceFolder + "\\" + strDestinationName + strExtension;
                            try
                            {
                                File.Move(item.Path, strDestinationFile);
                            }
                            catch (Exception)
                            {
                                ShowErrorDialog(dlg.SelectedId, sourceFolder + "\\" + strSourceName);
                            }
                            m_bReload = true;
                        }
                    }
                }
            }
            break;

            case 115:       // copy
            {
                SetMode(0); // copy
                FileItemDialog();
            }
            break;

            case 116:       // move
            {
                SetMode(1); // move
                FileItemDialog();
                m_bReload = true;
            }
            break;

            case 119: // make dir
            {
                MakeDir();
                m_bReload = true;
            }
            break;

            case 501: // set as destiantion
                destinationFolder = Path.GetFullPath(item.Path) + "\\";
                break;

            case 504: // goto destination
            {
                sourceFolder = destinationFolder;
                m_bReload    = true;
            }
            break;
            }
        }
Exemplo n.º 19
0
        /// <summary>
        /// Opens a menu dialog for choosing the resume option and returns the result.
        /// </summary>
        /// <param name="title">is used for the dialog's title.</param>
        /// <param name="lastStopTime">repesents the last stop time in seconds.</param>
        /// <param name="mediaType">defines for which media the dialog is displayed.
        /// Using LiveRecording displays the 'Resume from LivePoint' item.</param>
        /// <returns>Returns the result of the displayed resume dialog.</returns>
        public static Result ShowResumeDialog(string title, int lastStopTime, MediaType mediaType)
        {
            using (GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU))
            {
                if (dlg == null)
                {
                    return(Result.Error);
                }

                dlg.Reset();
                dlg.SetHeading(title);

                // add menu items
                GUIListItem itemBeginning = new GUIListItem(GetBeginningText(mediaType));
                dlg.Add(itemBeginning);

                GUIListItem itemLastStopTime = new GUIListItem(GetLastStopTimeText(mediaType, lastStopTime));
                if (lastStopTime > 0)
                {
                    dlg.Add(itemLastStopTime);
                }

                GUIListItem itemLivePoint = new GUIListItem(GUILocalizeStrings.Get(980));
                if (mediaType == MediaType.LiveRecording)
                {
                    dlg.Add(itemLivePoint);
                }

                // set focus to last stop time
                // itemIds 0 based, listindex (labels) 1 based
                dlg.SelectedLabel = itemLastStopTime.ItemId - 1;

                //// if dialog contains only beginning item, it is not needed to display it
                //if (lastStopTime <= 0 && mediaType != MediaType.LiveRecording)
                //  return Result.PlayFromBeginning;

                // show dialog
                dlg.DoModal(GUIWindowManager.ActiveWindow);

                // set results
                if (dlg.SelectedId == -1)
                {
                    return(Result.Abort);
                }

                if (dlg.SelectedId == itemBeginning.ItemId)
                {
                    return(Result.PlayFromBeginning);
                }

                if (dlg.SelectedId == itemLastStopTime.ItemId)
                {
                    return(Result.PlayFromLastStopTime);
                }

                if (dlg.SelectedId == itemLivePoint.ItemId)
                {
                    return(Result.PlayFromLivePoint);
                }

                return(Result.PlayFromBeginning);
            }
        }