コード例 #1
0
ファイル: GUIDialogFile.cs プロジェクト: hnjm/MediaPortal-1
        private void OnDeleteReadOnlyItem(GUIListItem item)
        {
            if (item.IsRemote)
            {
                return;
            }

            GUIDialogYesNo dlgYesNo = (GUIDialogYesNo)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_YES_NO);

            if (null == dlgYesNo)
            {
                return;
            }
            string strFileName = Path.GetFileName(item.Path);

            if (!item.IsFolder)
            {
                if (Util.Utils.IsAudio(item.Path))
                {
                    dlgYesNo.SetHeading(2000); // Audio
                }
                else if (Util.Utils.IsVideo(item.Path))
                {
                    dlgYesNo.SetHeading(2002); // Movie
                }
                else if (Util.Utils.IsPicture(item.Path))
                {
                    dlgYesNo.SetHeading(2001); // Picture
                }
                else
                {
                    dlgYesNo.SetHeading(2003); // Unknown file
                }
            }
            else
            {
                dlgYesNo.SetHeading(1989);
            }
            dlgYesNo.SetLine(1, 2004);
            dlgYesNo.SetLine(2, strFileName);
            dlgYesNo.SetLine(3, "");
            dlgYesNo.DoModal(GetID);

            if (!dlgYesNo.IsConfirmed)
            {
                return;
            }
            m_bReload = true;

            if (Directory.Exists(item.Path))
            {
                CleanDirectoryReadOnlyAttributes(item.Path);
            }
            else
            {
                File.SetAttributes(item.Path, File.GetAttributes(item.Path) & ~FileAttributes.ReadOnly);
            }

            DoDeleteItem(item);
        }
コード例 #2
0
        private void OnDeleteItem(GUIListItem item)
        {
            if (item.IsRemote)
            {
                return;
            }

            GUIDialogYesNo dlgYesNo = (GUIDialogYesNo)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_YES_NO);

            if (null == dlgYesNo)
            {
                return;
            }
            string strFileName = Path.GetFileName(item.Path);

            if (!item.IsFolder)
            {
                if (Util.Utils.IsAudio(item.Path))
                {
                    dlgYesNo.SetHeading(518); // Audio
                }
                else if (Util.Utils.IsVideo(item.Path))
                {
                    dlgYesNo.SetHeading(925); // Movie
                }
                else if (Util.Utils.IsPicture(item.Path))
                {
                    dlgYesNo.SetHeading(664); // Picture
                }
                else
                {
                    dlgYesNo.SetHeading(125); // Unknown file
                }
            }
            else
            {
                dlgYesNo.SetHeading(503);
            }
            dlgYesNo.SetLine(1, strFileName);
            dlgYesNo.SetLine(2, "");
            dlgYesNo.SetLine(3, "");
            dlgYesNo.DoModal(GetID);

            if (!dlgYesNo.IsConfirmed)
            {
                return;
            }
            m_bReload = true;
            DoDeleteItem(item);
        }
コード例 #3
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);
    }
コード例 #4
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);
        }