private void OnRecordProgram(Program program)
 {
   if (program == null)
   {
     return;
   }
   Log.Debug("TVProgammInfo.OnRecordProgram - programm = {0}", program.ToString());
   Schedule recordingSchedule;
   if (!anyUpcomingEpisodesRecording && currentSchedule != null)
   {
     CancelProgram(program, currentSchedule, GetID);
   }
   else if (IsRecordingProgram(program, out recordingSchedule, true)) // check if schedule is already existing
   {
     CancelProgram(program, recordingSchedule, GetID);
   }
   else
   {
     TvServer server = new TvServer();
     VirtualCard card;
     if (TVHome.Navigator.Channel.IdChannel == program.IdChannel &&
         server.IsRecording(TVHome.Navigator.Channel.IdChannel, out card))
     {
       Schedule schedFromDB = Schedule.Retrieve(card.RecordingScheduleId);
       if (schedFromDB.IsManual)
       {
         Schedule sched = Schedule.Retrieve(card.RecordingScheduleId);
         TVUtil.DeleteRecAndSchedWithPrompt(sched, program.IdChannel);
       }
       else
       {
         CreateProgram(program, (int)ScheduleRecordingType.Once, GetID);
       }
     }
     else
     {
       CreateProgram(program, (int)ScheduleRecordingType.Once, GetID);
     }
   }
   Update();
 }
예제 #2
0
    public static bool ManualRecord(Channel channel, int dialogId)
    {
      if (GUIWindowManager.ActiveWindowEx == (int)(int)Window.WINDOW_TVFULLSCREEN)
      {
        Log.Info("send message to fullscreen tv");
        GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_RECORD, GUIWindowManager.ActiveWindow, 0, 0, 0, 0,
                                        null);
        msg.SendToTargetWindow = true;
        msg.TargetWindowId = (int)(int)Window.WINDOW_TVFULLSCREEN;
        GUIGraphicsContext.SendMessage(msg);
        return false;
      }

      Log.Info("TVHome:Record action");
      var server = new TvServer();

      VirtualCard card = null;
      Program prog = channel.CurrentProgram;
      bool isRecording;
      bool hasProgram = (prog != null);
      if (hasProgram)
      {
        prog.Refresh();//refresh the states from db
        isRecording = (prog.IsRecording || prog.IsRecordingOncePending);
      }
      else
      {
        isRecording = server.IsRecording(channel.IdChannel, out card);
      }

      if (!isRecording)
      {
        if (hasProgram)
        {
          GUIDialogMenuBottomRight pDlgOK =
            (GUIDialogMenuBottomRight)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU_BOTTOM_RIGHT);
          if (pDlgOK != null)
          {
            pDlgOK.Reset();
            pDlgOK.SetHeading(605); //my tv
            pDlgOK.AddLocalizedString(875); //current program

            bool doesManuelScheduleAlreadyExist = DoesManualScheduleAlreadyExist(channel);
            if (!doesManuelScheduleAlreadyExist)
            {
              pDlgOK.AddLocalizedString(876); //till manual stop
            }
            pDlgOK.DoModal(GUIWindowManager.ActiveWindow);
            switch (pDlgOK.SelectedId)
            {
              case 875:
                //record current program                  
                TVProgramInfo.CreateProgram(prog, (int)ScheduleRecordingType.Once, dialogId);
                GUIMessage msgManualRecord = new GUIMessage(GUIMessage.MessageType.GUI_MSG_MANUAL_RECORDING_STARTED, 0, 0, 0, 0, 0, null);
                GUIWindowManager.SendMessage(msgManualRecord);
                return true;

              case 876:
                //manual
                StartRecordingSchedule(channel, true);
                return true;
             }
          }
        }
        else
        {
          //manual record
          StartRecordingSchedule(channel, true);
          return true;
        }
      }
      else
      {
        Schedule s = null;
        int idChannel = 0;
        if (hasProgram)
        {
          TVProgramInfo.IsRecordingProgram(prog, out s, false);
          if (s != null)
          {
            idChannel = s.ReferencedChannel().IdChannel;
          }
        }
        else
        {
          s = Schedule.Retrieve(card.RecordingScheduleId);
          idChannel = card.IdChannel;
        }

        if (s != null && idChannel > 0)
        {
          TVUtil.StopRecAndSchedWithPrompt(s, idChannel);
        }
      }
      return false;
    }
예제 #3
0
    /// <summary>
    /// Update the state of the following buttons    
    /// - record now
    /// </summary>
    private void UpdateStateOfRecButton()
    {
      if (!Connected)
      {
        btnTvOnOff.Selected = false;
        return;
      }
      bool isTimeShifting = Card.IsTimeShifting;

      //are we recording a tv program?      
      if (Navigator.Channel != null && Card != null)
      {
        string label;
        TvServer server = new TvServer();
        VirtualCard vc;
        if (server.IsRecording(Navigator.Channel.IdChannel, out vc))
        {
          if (!isTimeShifting)
          {
            Card = vc;
          }
          //yes then disable the timeshifting on/off buttons
          //and change the Record Now button into Stop Record
          label = GUILocalizeStrings.Get(629); //stop record
        }
        else
        {
          //nop. then change the Record Now button
          //to Record Now
          label = GUILocalizeStrings.Get(601); // record
        }
        if (label != btnRecord.Label)
        {
          btnRecord.Label = label;
        }
      }
    }
예제 #4
0
    private void SetRecorderStatus(bool forced)
    {
      if (imgRecIcon != null)
      {
        TimeSpan ts = DateTime.Now - _RecIconLastCheck;
        if (ts.TotalSeconds > 15 || forced)
        {
          bool isRecording = false;
          VirtualCard card;
          TvServer server = new TvServer();

          if (GetChannel() != null)
          {
            if (server.IsRecording(GetChannel().IdChannel, out card))
            {
              if (g_Player.IsTVRecording)
              {
                Recording rec = TvRecorded.ActiveRecording();
                if (rec != null)
                {
                  isRecording = TvRecorded.IsLiveRecording();
                }
              }
              else
              {
                isRecording = true;
              }
            }
          }

          imgRecIcon.Visible = isRecording;
          _RecIconLastCheck = DateTime.Now;
          Log.Info("OSD.SetRecorderStatus = {0}", imgRecIcon.Visible);
        }
      }
    }
예제 #5
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 channel = TVHome.Navigator.Channel;

        if (channel == null)
        {
          return true;
        }

        TvBusinessLayer layer = new TvBusinessLayer();

        Program prog = channel.CurrentProgram;
        VirtualCard card;
        TvServer server = new TvServer();
        if (server.IsRecording(channel.IdChannel, out card))
        {
          _dlgYesNo = (GUIDialogYesNo)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_YES_NO);
          _dlgYesNo.SetHeading(1449); // stop recording
          _dlgYesNo.SetLine(1, 1450); // are you sure to stop recording?
          if (prog != null)
          {
            _dlgYesNo.SetLine(2, prog.Title);
          }
          _dialogYesNoVisible = true;
          _dlgYesNo.DoModal(GetID);
          _dialogYesNoVisible = false;

          if (!_dlgYesNo.IsConfirmed)
          {
            return true;
          }

          Schedule s = Schedule.Retrieve(card.RecordingScheduleId);
          TVUtil.DeleteRecAndSchedQuietly(s, card.IdChannel);          

          GUIDialogNotify dlgNotify = (GUIDialogNotify)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_NOTIFY);
          if (dlgNotify == null)
          {
            return true;
          }
          string logo = Utils.GetCoverArt(Thumbs.TVChannel, channel.DisplayName);
          dlgNotify.Reset();
          dlgNotify.ClearAll();
          dlgNotify.SetImage(logo);
          dlgNotify.SetHeading(GUILocalizeStrings.Get(1447)); //recording stopped
          if (prog != null)
          {
            dlgNotify.SetText(String.Format("{0} {1}-{2}",
                                            prog.Title,
                                            prog.StartTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat),
                                            prog.EndTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat)));
          }
          else
          {
            dlgNotify.SetText(GUILocalizeStrings.Get(736)); //no tvguide data available
          }
          dlgNotify.TimeOut = 5;

          _notifyDialogVisible = true;
          dlgNotify.DoModal(GUIWindowManager.ActiveWindow);
          TvNotifyManager.ForceUpdate();
          _notifyDialogVisible = false;
          return true;
        }
        else
        {
          if (prog != null)
          {
            _dialogBottomMenu =
              (GUIDialogMenuBottomRight)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU_BOTTOM_RIGHT);
            if (_dialogBottomMenu != null)
            {
              _dialogBottomMenu.Reset();
              _dialogBottomMenu.SetHeading(605); //my tv
              //_dialogBottomMenu.SetHeadingRow2(prog.Title);              

              _dialogBottomMenu.AddLocalizedString(875); //current program
              _dialogBottomMenu.AddLocalizedString(876); //till manual stop
              _bottomDialogMenuVisible = true;

              _dialogBottomMenu.DoModal(GetID);

              _bottomDialogMenuVisible = false;
              switch (_dialogBottomMenu.SelectedId)
              {
                case 875:
                  //record current program
                  _isStartingTSForRecording = !g_Player.IsTimeShifting;

                  TVHome.StartRecordingSchedule(channel, false);
                  break;

                case 876:
                  //manual record
                  _isStartingTSForRecording = !g_Player.IsTimeShifting;

                  TVHome.StartRecordingSchedule(channel, true);
                  break;
                default:
                  return true;
              }
            }
          }
          else
          {
            _isStartingTSForRecording = !g_Player.IsTimeShifting;
            TVHome.StartRecordingSchedule(channel, true);
          }

          // check if recorder has to start timeshifting for this recording
          if (_isStartingTSForRecording)
          {
            Channel ch = Channel.Retrieve(TVHome.Card.IdChannel);
            TVHome.ViewChannel(ch);
            _isStartingTSForRecording = false;
          }

          GUIDialogNotify dlgNotify = (GUIDialogNotify)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_NOTIFY);
          if (dlgNotify == null)
          {
            return true;
          }
          string logo = Utils.GetCoverArt(Thumbs.TVChannel, channel.DisplayName);
          dlgNotify.Reset();
          dlgNotify.ClearAll();
          dlgNotify.SetImage(logo);
          dlgNotify.SetHeading(GUILocalizeStrings.Get(1446)); //recording started
          if (prog != null)
          {
            dlgNotify.SetText(String.Format("{0} {1}-{2}",
                                            prog.Title,
                                            prog.StartTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat),
                                            prog.EndTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat)));
          }
          else
          {
            dlgNotify.SetText(GUILocalizeStrings.Get(736)); //no tvguide data available
          }
          dlgNotify.TimeOut = 5;
          _notifyDialogVisible = true;
          dlgNotify.DoModal(GUIWindowManager.ActiveWindow);

          TvNotifyManager.ForceUpdate();


          _notifyDialogVisible = false;
        }
        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((TvPlugin.TVHome.ChannelErrorInfo)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

          // msn related can be removed
          //#region case GUI_MSG_MSN_CLOSECONVERSATION

          //case GUIMessage.MessageType.GUI_MSG_MSN_CLOSECONVERSATION:
          //  if (_msnWindowVisible)
          //  {
          //    ///@
          //    /// 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;
          //  break;

          //#endregion

          // msn related can be removed
          //#region case GUI_MSG_MSN_STATUS_MESSAGE

          //case GUIMessage.MessageType.GUI_MSG_MSN_STATUS_MESSAGE:

          //#endregion

          // msn related can be removed
          //#region case GUI_MSG_MSN_MESSAGE
          //case GUIMessage.MessageType.GUI_MSG_MSN_MESSAGE:
          //  if (_isOsdVisible && _isMsnChatPopup)
          //  {
          //    GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_WINDOW_DEINIT, _osdWindow.GetID, 0, 0, GetID, 0, null);
          //    _osdWindow.OnMessage(msg);	// Send a de-init msg to the OSD
          //    _isOsdVisible = false;
          //    GUIWindowManager.IsOsdVisible = false;

          //  }

          //  if (!_msnWindowVisible && _isMsnChatPopup)
          //  {
          //    Log.Debug("MSN CHAT:ON");
          //    _msnWindowVisible = true;
          //    GUIWindowManager.VisibleOsd = GUIWindow.Window.WINDOW_TVMSNOSD;
          //    ///@
          //    ///_msnWindow.DoModal(GetID, message);
          //    _msnWindowVisible = false;
          //    GUIWindowManager.IsOsdVisible = false;

          //  }
          //  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.MsnVisible = false;      // msn related can be removed
              _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);
            //_msnWindow = (GUITVMSNOSD)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_TVMSNOSD);     // msn related can be removed

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

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

            _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 (_msnWindowVisible) return true;     // msn related can be removed
          if (message.SenderControlId != (int)Window.WINDOW_TVFULLSCREEN)
          {
            return true;
          }
          break;

          #endregion
      }

      // msn related can be removed
      //if (_msnWindowVisible)
      //{
      //  ///@
      //  ///_msnWindow.OnMessage(message);	// route messages to MSNChat window
      //}
      return base.OnMessage(message);
    }
예제 #6
0
    private void UpdateGUI()
    {
      // Set recorder status
      VirtualCard card;
      var server = new TvServer();
      if (server.IsRecording(TVHome.Navigator.Channel.IdChannel, out card))
      {
        ShowControl(GetID, (int)Control.REC_LOGO);
      }
      else
      {
        HideControl(GetID, (int)Control.REC_LOGO);
      }

      int speed = g_Player.Speed;
      HideControl(GetID, (int)Control.IMG_2X);
      HideControl(GetID, (int)Control.IMG_4X);
      HideControl(GetID, (int)Control.IMG_8X);
      HideControl(GetID, (int)Control.IMG_16X);
      HideControl(GetID, (int)Control.IMG_32X);
      HideControl(GetID, (int)Control.IMG_MIN2X);
      HideControl(GetID, (int)Control.IMG_MIN4X);
      HideControl(GetID, (int)Control.IMG_MIN8X);
      HideControl(GetID, (int)Control.IMG_MIN16X);
      HideControl(GetID, (int)Control.IMG_MIN32X);

      switch (speed)
      {
        case 2:
          ShowControl(GetID, (int)Control.IMG_2X);
          break;
        case 4:
          ShowControl(GetID, (int)Control.IMG_4X);
          break;
        case 8:
          ShowControl(GetID, (int)Control.IMG_8X);
          break;
        case 16:
          ShowControl(GetID, (int)Control.IMG_16X);
          break;
        case 32:
          ShowControl(GetID, (int)Control.IMG_32X);
          break;
        case -2:
          ShowControl(GetID, (int)Control.IMG_MIN2X);
          break;
        case -4:
          ShowControl(GetID, (int)Control.IMG_MIN4X);
          break;
        case -8:
          ShowControl(GetID, (int)Control.IMG_MIN8X);
          break;
        case -16:
          ShowControl(GetID, (int)Control.IMG_MIN16X);
          break;
        case -32:
          ShowControl(GetID, (int)Control.IMG_MIN32X);
          break;
      }

      HideControl(GetID, (int)Control.LABEL_ROW1);
      HideControl(GetID, (int)Control.LABEL_ROW2);
      HideControl(GetID, (int)Control.LABEL_ROW3);
      HideControl(GetID, (int)Control.BLUE_BAR);
      if (_screenState.SeekStep != 0)
      {
        ShowControl(GetID, (int)Control.BLUE_BAR);
        ShowControl(GetID, (int)Control.LABEL_ROW1);
      }
      if (_statusVisible)
      {
        ShowControl(GetID, (int)Control.BLUE_BAR);
        ShowControl(GetID, (int)Control.LABEL_ROW1);
      }
      if (_groupVisible)
      {
        ShowControl(GetID, (int)Control.BLUE_BAR);
        ShowControl(GetID, (int)Control.LABEL_ROW1);
      }
      //if (_channelInputVisible)
      //{
      //  ShowControl(GetID, (int)Control.LABEL_ROW1);
      //}
      HideControl(GetID, (int)Control.MSG_BOX);
      HideControl(GetID, (int)Control.MSG_BOX_LABEL1);
      HideControl(GetID, (int)Control.MSG_BOX_LABEL2);
      HideControl(GetID, (int)Control.MSG_BOX_LABEL3);
      HideControl(GetID, (int)Control.MSG_BOX_LABEL4);

      if (_messageBoxVisible)
      {
        ShowControl(GetID, (int)Control.MSG_BOX);
        ShowControl(GetID, (int)Control.MSG_BOX_LABEL1);
        ShowControl(GetID, (int)Control.MSG_BOX_LABEL2);
        ShowControl(GetID, (int)Control.MSG_BOX_LABEL3);
        ShowControl(GetID, (int)Control.MSG_BOX_LABEL4);
      }

      RenderVolume(_isVolumeVisible);
    }
예제 #7
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;
      }
    }
예제 #8
0
    private void ShowPrograms()
    {
      if (lblOnTvNow != null)
      {
        lblOnTvNow.EnableUpDown = false;
        lblOnTvNow.Clear();
      }
      if (lblOnTvNext != null)
      {
        lblOnTvNext.EnableUpDown = false;
        lblOnTvNext.Clear();
      }

      // Set recorder status
      if (imgRecIcon != null)
      {
        VirtualCard card;
        TvServer server = new TvServer();
        imgRecIcon.IsVisible = server.IsRecording(idChannel, out card);
      }
      
      if (lblZapToCannelNo != null)
      {
        lblZapToCannelNo.Label = channelNr;
        lblZapToCannelNo.Visible = !string.IsNullOrEmpty(channelNr);
      }
      if (LastError != null)
      {        
        lblStartTime.Label = "";
        lblEndTime.Label = "";
        if (LastError.FailingChannel != null)
        {
          lblCurrentChannel.Label = LastError.FailingChannel.DisplayName;
        }
        if (LastError.Messages.Count > 0)
        {
          lblOnTvNow.Label = LastError.Messages[0]; // first line in "NOW"
          if (LastError.Messages.Count > 1)
          {
            lblOnTvNext.Label = String.Join(", ", LastError.Messages.ToArray(), 1, LastError.Messages.Count - 1);
            // 2nd and later in "NEXT"
          }
        }
        m_lastError = null; // reset member only, not the failing channel info in Navigator
      }
      else
      {
        if (lblCurrentChannel != null)
        {
          lblCurrentChannel.Label = channelName;
        }
        Channel chan = TVHome.Navigator.GetChannel(idChannel, true);
        Program prog = chan.GetProgramAt(m_dateTime);
        if (prog != null)
        {
          string strTime = String.Format("{0}-{1}",
                                         prog.StartTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat),
                                         prog.EndTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat));

          if (lblCurrentTime != null)
          {
            lblCurrentTime.Label = strTime;
          }

          if (lblOnTvNow != null)
          {
            lblOnTvNow.Label = prog.Title;
          }
          if (lblStartTime != null)
          {
            strTime = String.Format("{0}", prog.StartTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat));
            lblStartTime.Label = strTime;
          }
          if (lblEndTime != null)
          {
            strTime = String.Format("{0} ", prog.EndTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat));
            lblEndTime.Label = strTime;
          }

          // next program
          prog = chan.GetProgramAt(prog.EndTime.AddMinutes(1));
          //prog = TVHome.Navigator.GetChannel(channelName).GetProgramAt(prog.EndTime.AddMinutes(1));
          if (prog != null)
          {
            if (lblOnTvNext != null)
            {
              lblOnTvNext.Label = prog.Title;
            }
          }
        }
        else
        {
          lblOnTvNow.Label = GUILocalizeStrings.Get(736); // no epg for this channel

          if (lblStartTime != null)
          {
            lblStartTime.Label = String.Empty;
          }
          if (lblEndTime != null)
          {
            lblEndTime.Label = String.Empty;
          }
          if (lblCurrentTime != null)
          {
            lblCurrentTime.Label = String.Empty;
          }
        }
      }
      UpdateProgressBar();
    }