Пример #1
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;
        
      }
    }
Пример #2
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);
        }
Пример #3
0
        public void ShowFileMenu(GUIListItem item)
        {
            m_bReload = false;
            string 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)
            {
                bool readOnly;
                if (Directory.Exists(item.Path))
                {
                    readOnly = CheckDirectoryReadOnlyAttributes(item.Path);
                }
                else if (File.Exists(item.Path))
                {
                    FileAttributes attributes = File.GetAttributes(item.Path);
                    readOnly = ((attributes & FileAttributes.ReadOnly) == FileAttributes.ReadOnly);
                }
                else
                {
                    return;
                }

                if (readOnly)
                {
                    OnDeleteReadOnlyItem(item);
                }
                else
                {
                    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
                bool readOnly;
                if (Directory.Exists(item.Path))
                {
                    readOnly = CheckDirectoryReadOnlyAttributes(item.Path);
                }
                else
                {
                    FileAttributes attributes = File.GetAttributes(item.Path);
                    readOnly = ((attributes & FileAttributes.ReadOnly) == FileAttributes.ReadOnly);
                }
                if (readOnly)
                {
                    OnDeleteReadOnlyItem(item);
                }
                else
                {
                    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 ex)
                            {
                                Log.Error("GUIDialogFile:ShowFileMenu {0}", ex.Message);
                                ShowErrorDialog(dlg.SelectedId, sourceFolder + "\\" + strSourceName);
                            }
                            m_bReload = true;
                        }
                    }
                    else
                    {
                        // file rename
                        if (File.Exists(item.Path))
                        {
                            string strDestinationFile = sourceFolder + "\\" + strDestinationName + strExtension;
                            try
                            {
                                RenameRecording(item.Path, strDestinationFile);
                            }
                            catch (Exception ex)
                            {
                                Log.Error("GUIDialogFile:ShowFileMenu {0}", ex.Message);
                                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;
            }
        }
Пример #4
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;
 }
Пример #5
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;
        }
Пример #6
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;
              }
        }
Пример #7
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;
      }
    }
Пример #8
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);
            }
        }