コード例 #1
0
    private void InitChannels()
    {
      listViewChannels.Clear();
      listViewChannels.BeginUpdate();
      try
      {
        SqlBuilder sb = new SqlBuilder(Gentle.Framework.StatementType.Select, typeof (Channel));
        if (checkBoxGuideChannels.Checked)
        {
          sb.AddConstraint(Operator.Equals, "visibleInGuide", 1);
        }
        sb.AddConstraint(Operator.Equals, "isTv", 1);
        sb.AddOrderByField(true, "sortOrder");
        sb.AddOrderByField(true, "displayName");
        SqlStatement stmt = sb.GetStatement(true);
        IList<Channel> channels = ObjectFactory.GetCollection<Channel>(stmt.Execute());

        for (int i = 0; i < channels.Count; i++)
        {
          // TODO: add imagelist with channel logos from MP :)
          ListViewItem curItem = new ListViewItem(channels[i].DisplayName);
          curItem.Tag = channels[i];
          listViewChannels.Items.Add(curItem);
        }
      }
      finally
      {
        listViewChannels.EndUpdate();
      }
      mpButtonOk.Enabled = (listViewChannels.Items.Count > 0);
    }
コード例 #2
0
    /// <summary>
    /// gets a value from the database table "Setting"
    /// </summary>
    /// <returns>A Setting object with the stored value, if it doesnt exist the given default string will be the value</returns>
    private Setting GetSetting(string tagName, string defaultValue)
    {
      if (defaultValue == null)
      {
        return null;
      }
      if (tagName == null)
      {
        return null;
      }
      if (tagName == "")
      {
        return null;
      }
      SqlBuilder sb;
      try
      {
        sb = new SqlBuilder(Gentle.Framework.StatementType.Select, typeof(Setting));
      }
      catch (TypeInitializationException)
      {
        return new Setting(tagName,defaultValue);
      }

      sb.AddConstraint(Operator.Equals, "tag", tagName);
      SqlStatement stmt = sb.GetStatement(true);
      IList<Setting> settingsFound = ObjectFactory.GetCollection<Setting>(stmt.Execute());
      if (settingsFound.Count == 0)
      {
        Setting set = new Setting(tagName, defaultValue);
        set.Persist();
        return set;
      }
      return settingsFound[0];
    }
コード例 #3
0
        public void RemoveAllAttendancesOfPerson(Person aPerson)
        {
            SqlBuilder sb = new SqlBuilder(StatementType.Delete, typeof(Attendance));
            sb.AddConstraint(Operator.Equals, "id_person", aPerson.Id);

            SqlStatement stmt = sb.GetStatement(true);
            stmt.Execute();
        }
コード例 #4
0
        public void RemoveAllAttendancesOfEvent(Event anEvent)
        {
            SqlBuilder sb = new SqlBuilder(StatementType.Delete, typeof(Attendance));
            sb.AddConstraint(Operator.Equals, "id_event", anEvent.Id);

            SqlStatement stmt = sb.GetStatement(true);
            stmt.Execute();
        }
コード例 #5
0
    public void OnActivated()
    {
      try
      {
        Application.DoEvents();

        Cursor.Current = Cursors.WaitCursor;

        UpdateMenuAndTabs();

        listView1.Items.Clear();
        SqlBuilder sb = new SqlBuilder(StatementType.Select, typeof (GroupMap));

        sb.AddConstraint(Operator.Equals, "idGroup", _channelGroup.IdGroup);
        sb.AddOrderByField(true, "sortOrder");

        SqlStatement stmt = sb.GetStatement(true);

        IList<GroupMap> maps = ObjectFactory.GetCollection<GroupMap>(stmt.Execute());

        foreach (GroupMap map in maps)
        {
          Channel channel = map.ReferencedChannel();
          if (!channel.IsTv)
          {
            continue;
          }
          listView1.Items.Add(CreateItemForChannel(channel, map));
        }
        bool isAllChannelsGroup = (_channelGroup.GroupName == TvConstants.TvGroupNames.AllChannels);
        removeChannelFromGroup.Enabled = !isAllChannelsGroup;
        mpButtonDel.Enabled = !isAllChannelsGroup;

        if (_channelGroup.GroupName != TvConstants.TvGroupNames.AllChannels)
        {
          labelPinCode.Visible = true;
          textBoxPinCode.Visible = true;
          textBoxPinCode.Text = _channelGroup.PinCode;
        }

      }
      catch (Exception exp)
      {
        Log.Error("OnActivated error: {0}", exp.Message);
      }
      finally
      {
        Cursor.Current = Cursors.Default;
      }
    }
コード例 #6
0
        private void CreateShareForm_Load(object sender, EventArgs e)
        {
            _channelNameLabel.Text = this.Channel.DisplayName;
            LoadGroups();

            LinkedMediaPortalChannel linkedChannel = ChannelLinks.GetLinkedMediaPortalChannel(this.Channel);
            if (linkedChannel != null)
            {
                SqlBuilder sb = new SqlBuilder(StatementType.Select, typeof(TvDatabase.GroupMap));
                sb.AddConstraint(Operator.Equals, "idChannel", linkedChannel.Id);
                SqlResult result = Broker.Execute(sb.GetStatement());
                List<TvDatabase.GroupMap> groupMaps = (List<TvDatabase.GroupMap>)
                    ObjectFactory.GetCollection(typeof(TvDatabase.GroupMap), result, new List<TvDatabase.GroupMap>());
                if (groupMaps.Count > 0)
                {
                    foreach (ListViewItem item in _groupsListView.Items)
                    {
                        if (item.Tag is int
                            && (int)item.Tag == groupMaps[0].IdGroup)
                        {
                            item.Selected = true;
                            _groupsListView.EnsureVisible(item.Index);
                            break;
                        }
                        else
                        {
                            item.Selected = false;
                        }
                    }

                    foreach (ListViewItem item in _channelsListView.Items)
                    {
                        ChannelItem channelItem = item.Tag as ChannelItem;
                        if (channelItem.Channel.IdChannel == linkedChannel.Id)
                        {
                            item.Selected = true;
                            _channelsListView.EnsureVisible(item.Index);
                            break;
                        }
                        else
                        {
                            item.Selected = false;
                        }
                    }
                }
            }
        }
コード例 #7
0
    /// <summary>
    /// gets a value from the database table "Setting"
    /// </summary>
    /// <returns>A Setting object with the stored value, if it doesnt exist a empty string will be the value</returns>
    public Setting GetSetting(string tagName)
    {
      SqlBuilder sb;
      try
      {
        sb = new SqlBuilder(StatementType.Select, typeof (Setting));
      }
      catch (TypeInitializationException)
      {
        checkGentleFiles(); // Try to throw a more meaningfull exception
        throw; // else re-throw the original error
      }

      sb.AddConstraint(Operator.Equals, "tag", tagName);
      SqlStatement stmt = sb.GetStatement(true);
      IList<Setting> settingsFound = ObjectFactory.GetCollection<Setting>(stmt.Execute());
      if (settingsFound.Count == 0)
      {
        Setting set = new Setting(tagName, "");
        set.Persist();
        return set;
      }
      return settingsFound[0];
    }
コード例 #8
0
    public IList<TuningDetail> GetTuningDetailsByName(string name, int channelType)
    {
      SqlBuilder sb = new SqlBuilder(StatementType.Select, typeof (TuningDetail));
      sb.AddConstraint(Operator.Equals, "name", name);
      sb.AddConstraint(Operator.Equals, "channelType", channelType);

      SqlStatement stmt = sb.GetStatement(true);
      IList<TuningDetail> details = ObjectFactory.GetCollection<TuningDetail>(stmt.Execute());
      return details;
    }
コード例 #9
0
    public TuningDetail GetTuningDetail(String url, int channelType)
    {
      SqlBuilder sb = new SqlBuilder(StatementType.Select, typeof(TuningDetail));
      sb.AddConstraint(Operator.Equals, "url", url);
      sb.AddConstraint(Operator.Equals, "channelType", channelType);

      SqlStatement stmt = sb.GetStatement(true);
      IList<TuningDetail> details = ObjectFactory.GetCollection<TuningDetail>(stmt.Execute());

      if (details == null)
      {
        return null;
      }
      if (details.Count == 0)
      {
        return null;
      }
      return details[0];
    }
コード例 #10
0
 public IList<SoftwareEncoder> GetSofwareEncodersAudio()
 {
   SqlBuilder sb = new SqlBuilder(StatementType.Select, typeof (SoftwareEncoder));
   sb.AddConstraint(Operator.Equals, "type", 1);
   sb.AddOrderByField(true, "priority");
   SqlStatement stmt = sb.GetStatement(true);
   return ObjectFactory.GetCollection<SoftwareEncoder>(stmt.Execute());
 }
コード例 #11
0
 public RadioChannelGroup GetRadioChannelGroupByName(string name)
 {
   SqlBuilder sb = new SqlBuilder(StatementType.Select, typeof (RadioChannelGroup));
   sb.AddConstraint(Operator.Equals, "groupName", name);
   SqlStatement stmt = sb.GetStatement(true);
   IList<RadioChannelGroup> groups = ObjectFactory.GetCollection<RadioChannelGroup>(stmt.Execute());
   if (groups == null)
   {
     return null;
   }
   if (groups.Count == 0)
   {
     return null;
   }
   return groups[0];
 }
コード例 #12
0
 // Get schedules to import from xml
 public Schedule GetSchedule(int idChannel, string programName, DateTime startTime, DateTime endTime,
                             int scheduleType)
 {
   SqlBuilder sb = new SqlBuilder(StatementType.Select, typeof (Schedule));
   sb.AddConstraint(Operator.Equals, "idChannel", idChannel);
   sb.AddConstraint(Operator.Equals, "programName", programName);
   sb.AddConstraint(Operator.Equals, "startTime", startTime);
   sb.AddConstraint(Operator.Equals, "endTime", endTime);
   sb.AddConstraint(Operator.Equals, "scheduleType", scheduleType);
   SqlStatement stmt = sb.GetStatement(true);
   Log.Info(stmt.Sql);
   IList<Schedule> schedules = ObjectFactory.GetCollection<Schedule>(stmt.Execute());
   if (schedules == null)
   {
     return null;
   }
   if (schedules.Count == 0)
   {
     return null;
   }
   return schedules[0];
 }
コード例 #13
0
    private void AddSelectedItemsToGroup(MPListView sourceListView)
    {
      if (_channelGroup == null)
      {
        return;
      }

      TvBusinessLayer layer = new TvBusinessLayer();
      foreach (ListViewItem sourceItem in sourceListView.SelectedItems)
      {
        Channel channel = null;
        if (sourceItem.Tag is Channel)
        {
          channel = (Channel)sourceItem.Tag;
        }
        else if (sourceItem.Tag is RadioGroupMap)
        {
          channel = layer.GetChannel(((RadioGroupMap)sourceItem.Tag).IdChannel);
        }
        else
        {
          continue;
        }

        RadioGroupMap groupMap = null;

        layer.AddChannelToRadioGroup(channel, _channelGroup);

        //get the new group map and set the listitem tag
        SqlBuilder sb = new SqlBuilder(StatementType.Select, typeof (RadioGroupMap));

        sb.AddConstraint(Operator.Equals, "idChannel", channel.IdChannel);
        sb.AddConstraint(Operator.Equals, "idGroup", _channelGroup.IdGroup);

        SqlStatement stmt = sb.GetStatement(true);

        groupMap = ObjectFactory.GetInstance<RadioGroupMap>(stmt.Execute());

        foreach (ListViewItem item in listView1.Items)
        {
          if ((item.Tag as Channel) == channel)
          {
            item.Tag = groupMap;
            break;
          }
        }
      }
    }
コード例 #14
0
    public void ReLoad()
    {
      //System.Diagnostics.Debugger.Launch();
      try
      {
        SetupDatabaseConnection();
        Log.Info("get channels from database");
        SqlBuilder sb = new SqlBuilder(StatementType.Select, typeof (Channel));
        sb.AddConstraint(Operator.Equals, "isTv", 1);
        sb.AddOrderByField(true, "sortOrder");
        SqlStatement stmt = sb.GetStatement(true);
        channels = ObjectFactory.GetCollection(typeof (Channel), stmt.Execute());
        Log.Info("found:{0} tv channels", channels.Count);
        TvNotifyManager.OnNotifiesChanged();
        m_groups.Clear();

        TvBusinessLayer layer = new TvBusinessLayer();
        RadioChannelGroup allRadioChannelsGroup =
          layer.GetRadioChannelGroupByName(TvConstants.RadioGroupNames.AllChannels);
        IList<Channel> radioChannels = layer.GetAllRadioChannels();
        if (radioChannels != null)
        {
          if (radioChannels.Count > allRadioChannelsGroup.ReferringRadioGroupMap().Count)
          {
            foreach (Channel radioChannel in radioChannels)
            {
              layer.AddChannelToRadioGroup(radioChannel, allRadioChannelsGroup);
            }
          }
        }
        Log.Info("Done.");

        Log.Info("get all groups from database");
        sb = new SqlBuilder(StatementType.Select, typeof (ChannelGroup));
        sb.AddOrderByField(true, "groupName");
        stmt = sb.GetStatement(true);
        IList<ChannelGroup> groups = ObjectFactory.GetCollection<ChannelGroup>(stmt.Execute());
        IList<GroupMap> allgroupMaps = GroupMap.ListAll();

        bool hideAllChannelsGroup = false;
        using (
          Settings xmlreader =
            new MPSettings())
        {
          hideAllChannelsGroup = xmlreader.GetValueAsBool("mytv", "hideAllChannelsGroup", false);
        }


        foreach (ChannelGroup group in groups)
        {
          if (group.GroupName == TvConstants.TvGroupNames.AllChannels)
          {
            foreach (Channel channel in channels)
            {
              if (channel.IsTv == false)
              {
                continue;
              }
              bool groupContainsChannel = false;
              foreach (GroupMap map in allgroupMaps)
              {
                if (map.IdGroup != group.IdGroup)
                {
                  continue;
                }
                if (map.IdChannel == channel.IdChannel)
                {
                  groupContainsChannel = true;
                  break;
                }
              }
              if (!groupContainsChannel)
              {
                layer.AddChannelToGroup(channel, TvConstants.TvGroupNames.AllChannels);
              }
            }
            break;
          }
        }

        groups = ChannelGroup.ListAll();
        foreach (ChannelGroup group in groups)
        {
          //group.GroupMaps.ApplySort(new GroupMap.Comparer(), false);
          if (hideAllChannelsGroup && group.GroupName.Equals(TvConstants.TvGroupNames.AllChannels) && groups.Count > 1)
          {
            continue;
          }
          m_groups.Add(group);
        }
        Log.Info("loaded {0} tv groups", m_groups.Count);

        //TVHome.Connected = true;
      }
      catch (Exception ex)
      {
        Log.Error("TVHome: Error in Reload");
        Log.Error(ex);
        //TVHome.Connected = false;
      }
    }
コード例 #15
0
ファイル: TvOSD.cs プロジェクト: cmendozac/MediaPortal-1
    public override bool OnMessage(GUIMessage message)
    {
      switch (message.Message)
      {
        case GUIMessage.MessageType.GUI_MSG_WINDOW_DEINIT: // fired when OSD is hidden
          {
            //if (g_application.m_pPlayer) g_application.m_pPlayer.ShowOSD(true);
            // following line should stay. Problems with OSD not
            // appearing are already fixed elsewhere
            //for (int i = (int)Controls.Panel1; i < (int)Controls.Panel2; i++)
            //{
            //  HideControl(GetID, i);
            //}
            Dispose();
            GUIPropertyManager.SetProperty("#currentmodule", GUIWindowManager.GetWindow(message.Param1).GetModuleName());
            return true;
          }


        case GUIMessage.MessageType.GUI_MSG_WINDOW_INIT: // fired when OSD is shown
          {
            // following line should stay. Problems with OSD not
            // appearing are already fixed elsewhere
            SqlBuilder sb = new SqlBuilder(StatementType.Select, typeof (Channel));
            sb.AddConstraint(Operator.Equals, "istv", 1);
            sb.AddOrderByField(true, "sortOrder");
            SqlStatement stmt = sb.GetStatement(true);
            listTvChannels = ObjectFactory.GetCollection(typeof (Channel), stmt.Execute());
            GUIPropertyManager.SetProperty("#currentmodule", GetModuleName());
            previousProgram = null;
            AllocResources();
            // if (g_application.m_pPlayer) g_application.m_pPlayer.ShowOSD(false);
            ResetAllControls(); // make sure the controls are positioned relevant to the OSD Y offset
            isSubMenuVisible = false;
            m_iActiveMenuButtonID = 0;
            m_iActiveMenu = 0;
            m_bNeedRefresh = false;
            m_dateTime = DateTime.Now;
            Reset();
            FocusControl(GetID, (int)Controls.OSD_PLAY, 0); // set focus to play button by default when window is shown
            ShowPrograms();
            QueueAnimation(AnimationType.WindowOpen);
            for (int i = (int)Controls.Panel1; i < (int)Controls.Panel2; i++)
            {
              ShowControl(GetID, i);
            }
            if (g_Player.Paused)
            {
              ToggleButton((int)Controls.OSD_PLAY, true);
              // make sure play button is down (so it shows the pause symbol)
            }
            else
            {
              ToggleButton((int)Controls.OSD_PLAY, false); // make sure play button is up (so it shows the play symbol)
            }
            m_delayInterval = MediaPortal.Player.Subtitles.SubEngine.GetInstance().DelayInterval;
            if (m_delayInterval > 0)
              m_subtitleDelay = MediaPortal.Player.Subtitles.SubEngine.GetInstance().Delay / m_delayInterval;
            m_delayIntervalAudio = PostProcessingEngine.GetInstance().AudioDelayInterval;
            if (m_delayIntervalAudio > 0)
              m_audioDelay = PostProcessingEngine.GetInstance().AudioDelay / m_delayIntervalAudio;

            g_Player.UpdateMediaInfoProperties();
            GUIPropertyManager.SetProperty("#TV.View.HasTeletext", TVHome.Card.HasTeletext.ToString());

            MediaPortal.Player.VideoStreamFormat videoFormat = g_Player.GetVideoFormat();

            GUIPropertyManager.SetProperty("#Play.Current.TSBitRate",
             ((float)MediaPortal.Player.g_Player.GetVideoFormat().bitrate / 1024 / 1024).ToString("0.00", CultureInfo.InvariantCulture));

            GUIPropertyManager.SetProperty("#Play.Current.VideoFormat.RawResolution",
              videoFormat.width.ToString() + "x" + videoFormat.height.ToString());

            GUIPropertyManager.SetProperty("#TV.TuningDetails.FreeToAir", string.Empty);

            Channel chan = TVHome.Navigator.Channel;
            if (chan != null)
            {
              IList<TuningDetail> details = chan.ReferringTuningDetail();
              if (details.Count > 0)
              {
                TuningDetail detail = null;
                switch (TVHome.Card.Type)
                {
                  case TvLibrary.Interfaces.CardType.Analog:
                    foreach (TuningDetail t in details)
                    {
                      if (t.ChannelType == 0)
                        detail = t;
                    }
                    break;
                  case TvLibrary.Interfaces.CardType.Atsc:
                    foreach (TuningDetail t in details)
                    {
                      if (t.ChannelType == 1)
                        detail = t;
                    }
                    break;
                  case TvLibrary.Interfaces.CardType.DvbC:
                    foreach (TuningDetail t in details)
                    {
                      if (t.ChannelType == 2)
                        detail = t;
                    }
                    break;
                  case TvLibrary.Interfaces.CardType.DvbS:
                    foreach (TuningDetail t in details)
                    {
                      if (t.ChannelType == 3)
                        detail = t;
                    }
                    break;
                  case TvLibrary.Interfaces.CardType.DvbT:
                    foreach (TuningDetail t in details)
                    {
                      if (t.ChannelType == 4)
                        detail = t;
                    }
                    break;
                  default:
                    detail = details[0];
                    break;
                }
                GUIPropertyManager.SetProperty("#TV.TuningDetails.FreeToAir", detail.FreeToAir.ToString());
              }
            }
          }
          return true;

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

        case GUIMessage.MessageType.GUI_MSG_LOSTFOCUS:
          {
            if (message.SenderControlId == 13)
            {
              return true;
            }
          }
          break;

        case GUIMessage.MessageType.GUI_MSG_CLICKED:
          {
            int iControl = message.SenderControlId; // get the ID of the control sending us a message

            if (iControl == btnChannelUp.GetID)
            {
              OnNextChannel();
            }

            if (iControl == btnChannelDown.GetID)
            {
              OnPreviousChannel();
            }

            if (!g_Player.IsTVRecording)
            {
              if (iControl == btnPreviousProgram.GetID)
              {
                Program prog = GetChannel().GetProgramAt(m_dateTime);
                if (prog != null)
                {
                  prog =
                    GetChannel().GetProgramAt(
                      prog.StartTime.Subtract(new TimeSpan(0, 1, 0)));
                  if (prog != null)
                  {
                    m_dateTime = prog.StartTime.AddMinutes(1);
                  }
                }
                ShowPrograms();
              }
              if (iControl == btnNextProgram.GetID)
              {
                Program prog = GetChannel().GetProgramAt(m_dateTime);
                if (prog != null)
                {
                  prog = GetChannel().GetProgramAt(prog.EndTime.AddMinutes(+1));
                  if (prog != null)
                  {
                    m_dateTime = prog.StartTime.AddMinutes(1);
                  }
                }
                ShowPrograms();
              }
            }

            if (iControl >= (int)Controls.OSD_VOLUMESLIDER)
              // one of the settings (sub menu) controls is sending us a message
            {
              Handle_ControlSetting(iControl, message.Param1);
            }

            if (iControl == (int)Controls.OSD_PAUSE)
            {
              if (g_Player.Paused)
              {
                ToggleButton((int)Controls.OSD_PLAY, true);
                // make sure play button is down (so it shows the pause symbol)                
                ToggleButton((int)Controls.OSD_FFWD, false); // pop the button back to it's up state
                ToggleButton((int)Controls.OSD_REWIND, false); // pop the button back to it's up state
              }
              else
              {
                ToggleButton((int)Controls.OSD_PLAY, false);
                // make sure play button is up (so it shows the play symbol)
                if (g_Player.Speed < 1) // are we not playing back at normal speed
                {
                  ToggleButton((int)Controls.OSD_REWIND, true); // make sure out button is in the down position
                  ToggleButton((int)Controls.OSD_FFWD, false); // pop the button back to it's up state
                }
                else
                {
                  ToggleButton((int)Controls.OSD_REWIND, false); // pop the button back to it's up state
                  if (g_Player.Speed == 1)
                  {
                    ToggleButton((int)Controls.OSD_FFWD, false); // pop the button back to it's up state
                  }
                }
              }
            }

            if (iControl == (int)Controls.OSD_PLAY)
            {
              //TODO
              int iSpeed = g_Player.Speed;
              if (iSpeed != 1) // we're in ffwd or rewind mode
              {
                g_Player.Speed = 1; // drop back to single speed
                ToggleButton((int)Controls.OSD_REWIND, false); // pop all the relevant
                ToggleButton((int)Controls.OSD_FFWD, false); // buttons back to
                ToggleButton((int)Controls.OSD_PLAY, false); // their up state
              }
              else
              {
                g_Player.Pause(); // Pause/Un-Pause playback
                if (g_Player.Paused)
                {
                  ToggleButton((int)Controls.OSD_PLAY, true);
                  // make sure play button is down (so it shows the pause symbol)
                }
                else
                {
                  ToggleButton((int)Controls.OSD_PLAY, false);
                  // make sure play button is up (so it shows the play symbol)
                }
              }
            }

            if (iControl == (int)Controls.OSD_STOP)
            {
              if (isSubMenuVisible) // sub menu currently active ?
              {
                FocusControl(GetID, m_iActiveMenuButtonID, 0); // set focus to last menu button
                ToggleSubMenu(0, m_iActiveMenu); // hide the currently active sub-menu
              }
              //g_application.m_guiWindowFullScreen.m_bOSDVisible = false;	// toggle the OSD off so parent window can de-init
              Log.Debug("TVOSD:stop");
              if (TVHome.Card.IsRecording)
              {
                int id = TVHome.Card.RecordingScheduleId;
                if (id > 0)
                {
                  TVHome.TvServer.StopRecordingSchedule(id);
                }
              }
              //GUIWindowManager.ShowPreviousWindow();							// go back to the previous window
            }

            if (iControl == (int)Controls.OSD_REWIND)
            {
              if (g_Player.Paused)
              {
                g_Player.Pause(); // Unpause playback
              }

              if (g_Player.Speed < 1) // are we not playing back at normal speed
              {
                ToggleButton((int)Controls.OSD_REWIND, true); // make sure out button is in the down position
                ToggleButton((int)Controls.OSD_FFWD, false); // pop the button back to it's up state
              }
              else
              {
                ToggleButton((int)Controls.OSD_REWIND, false); // pop the button back to it's up state
                if (g_Player.Speed == 1)
                {
                  ToggleButton((int)Controls.OSD_FFWD, false); // pop the button back to it's up state
                }
              }
            }

            if (iControl == (int)Controls.OSD_FFWD)
            {
              if (g_Player.Paused)
              {
                g_Player.Pause(); // Unpause playback
              }

              if (g_Player.Speed > 1) // are we not playing back at normal speed
              {
                ToggleButton((int)Controls.OSD_FFWD, true); // make sure out button is in the down position
                ToggleButton((int)Controls.OSD_REWIND, false); // pop the button back to it's up state
              }
              else
              {
                ToggleButton((int)Controls.OSD_FFWD, false); // pop the button back to it's up state
                if (g_Player.Speed == 1)
                {
                  ToggleButton((int)Controls.OSD_REWIND, false); // pop the button back to it's up state
                }
              }
            }

            if (iControl == (int)Controls.OSD_SKIPBWD)
            {
              if (_immediateSeekIsRelative)
              {
                g_Player.SeekRelativePercentage(-_immediateSeekValue);
              }
              else
              {
                g_Player.SeekRelative(-_immediateSeekValue);
              }
              ToggleButton((int)Controls.OSD_SKIPBWD, false); // pop the button back to it's up state
            }

            if (iControl == (int)Controls.OSD_SKIPFWD)
            {
              if (_immediateSeekIsRelative)
              {
                g_Player.SeekRelativePercentage(_immediateSeekValue);
              }
              else
              {
                g_Player.SeekRelative(_immediateSeekValue);
              }
              ToggleButton((int)Controls.OSD_SKIPFWD, false); // pop the button back to it's up state
            }

            if (iControl == (int)Controls.OSD_MUTE)
            {
              ToggleSubMenu(iControl, (int)Controls.OSD_SUBMENU_BG_VOL); // hide or show the sub-menu
              if (isSubMenuVisible) // is sub menu on?
              {
                int iValue = g_Player.Volume;
                GUISliderControl pSlider = GetControl((int)Controls.OSD_VOLUMESLIDER) as GUISliderControl;
                if (null != pSlider)
                {
                  pSlider.Percentage = iValue; // Update our volume slider accordingly ...
                }
                ShowControl(GetID, (int)Controls.OSD_VOLUMESLIDER); // show the volume control
                ShowControl(GetID, (int)Controls.OSD_VOLUMESLIDER_LABEL);
                FocusControl(GetID, (int)Controls.OSD_VOLUMESLIDER, 0); // set focus to it
              }
              else // sub menu is off
              {
                FocusControl(GetID, (int)Controls.OSD_MUTE, 0); // set focus to the mute button
              }
            }

            if (iControl == (int)Controls.OSD_SUBTITLES)
            {
              ToggleSubMenu(iControl, (int)Controls.OSD_SUBMENU_BG_SUBTITLES); // hide or show the sub-menu
              if (isSubMenuVisible)
              {
                // set the controls values
                GUISliderControl pControl = (GUISliderControl)GetControl((int)Controls.OSD_SUBTITLE_DELAY);
                pControl.SpinType = GUISpinControl.SpinType.SPIN_CONTROL_TYPE_FLOAT;
                pControl.FloatInterval = 1;
                pControl.SetRange(-10, 10);
                SetSliderValue(-10, 10, m_subtitleDelay, (int)Controls.OSD_SUBTITLE_DELAY);
                SetCheckmarkValue(g_Player.EnableSubtitle, (int)Controls.OSD_SUBTITLE_ONOFF);
                // show the controls on this sub menu
                ShowControl(GetID, (int)Controls.OSD_SUBTITLE_DELAY);
                ShowControl(GetID, (int)Controls.OSD_SUBTITLE_DELAY_LABEL);
                ShowControl(GetID, (int)Controls.OSD_SUBTITLE_ONOFF);
                ShowControl(GetID, (int)Controls.OSD_SUBTITLE_LIST);

                FocusControl(GetID, (int)Controls.OSD_SUBTITLE_DELAY, 0);
                // set focus to the first control in our group
                PopulateSubTitles(); // populate the list control with subtitles for this video
              }
            }

            if (iControl == (int)Controls.OSD_BOOKMARKS)
            {
              //not used
            }

            if (iControl == (int)Controls.OSD_VIDEO)
            {
              ToggleSubMenu(iControl, (int)Controls.OSD_SUBMENU_BG_VIDEO); // hide or show the sub-menu
              if (isSubMenuVisible) // is sub menu on?
              {
                // set the controls values
                float fPercent = (float)(100 * (g_Player.CurrentPosition / g_Player.Duration));
                SetSliderValue(0.0f, 100.0f, (float)fPercent, (int)Controls.OSD_VIDEOPOS);

                bool hasPostProc = g_Player.HasPostprocessing;
                if (hasPostProc)
                {
                  IPostProcessingEngine engine = PostProcessingEngine.GetInstance();
                  SetCheckmarkValue(engine.EnablePostProcess, (int)Controls.OSD_VIDEO_POSTPROC_DEBLOCK_ONOFF);
                  SetCheckmarkValue(engine.EnableResize, (int)Controls.OSD_VIDEO_POSTPROC_RESIZE_ONOFF);
                  SetCheckmarkValue(engine.EnableCrop, (int)Controls.OSD_VIDEO_POSTPROC_CROP_ONOFF);
                  SetCheckmarkValue(engine.EnableDeinterlace, (int)Controls.OSD_VIDEO_POSTPROC_DEINTERLACE_ONOFF);
                  UpdatePostProcessing();
                  ShowControl(GetID, (int)Controls.OSD_VIDEO_POSTPROC_DEBLOCK_ONOFF);
                  ShowControl(GetID, (int)Controls.OSD_VIDEO_POSTPROC_RESIZE_ONOFF);
                  ShowControl(GetID, (int)Controls.OSD_VIDEO_POSTPROC_CROP_ONOFF);
                  ShowControl(GetID, (int)Controls.OSD_VIDEO_POSTPROC_DEINTERLACE_ONOFF);
                  ShowControl(GetID, (int)Controls.OSD_VIDEO_POSTPROC_CROP_VERTICAL);
                  ShowControl(GetID, (int)Controls.OSD_VIDEO_POSTPROC_CROP_HORIZONTAL);
                  ShowControl(GetID, (int)Controls.OSD_VIDEO_POSTPROC_CROP_VERTICAL_LABEL);
                  ShowControl(GetID, (int)Controls.OSD_VIDEO_POSTPROC_CROP_HORIZONTAL_LABEL);
                }

                //SetCheckmarkValue(g_stSettings.m_bNonInterleaved, Controls.OSD_NONINTERLEAVED);
                //SetCheckmarkValue(g_stSettings.m_bNoCache, Controls.OSD_NOCACHE);
                //SetCheckmarkValue(g_stSettings.m_bFrameRateConversions, Controls.OSD_ADJFRAMERATE);

                UpdateGammaContrastBrightness();
                // show the controls on this sub menu
                ShowControl(GetID, (int)Controls.OSD_VIDEOPOS);
                ShowControl(GetID, (int)Controls.OSD_VIDEOPOS_LABEL);
                ShowControl(GetID, (int)Controls.OSD_NONINTERLEAVED);
                ShowControl(GetID, (int)Controls.OSD_NOCACHE);
                ShowControl(GetID, (int)Controls.OSD_ADJFRAMERATE);
                ShowControl(GetID, (int)Controls.OSD_SATURATIONLABEL);
                ShowControl(GetID, (int)Controls.OSD_SATURATION);
                ShowControl(GetID, (int)Controls.OSD_SHARPNESSLABEL);
                ShowControl(GetID, (int)Controls.OSD_SHARPNESS);
                ShowControl(GetID, (int)Controls.OSD_BRIGHTNESS);
                ShowControl(GetID, (int)Controls.OSD_BRIGHTNESSLABEL);
                ShowControl(GetID, (int)Controls.OSD_CONTRAST);
                ShowControl(GetID, (int)Controls.OSD_CONTRASTLABEL);
                ShowControl(GetID, (int)Controls.OSD_GAMMA);
                ShowControl(GetID, (int)Controls.OSD_GAMMALABEL);
                FocusControl(GetID, (int)Controls.OSD_VIDEOPOS, 0); // set focus to the first control in our group
              }
            }

            if (iControl == (int)Controls.OSD_AUDIO)
            {
              ToggleSubMenu(iControl, (int)Controls.OSD_SUBMENU_BG_AUDIO); // hide or show the sub-menu
              if (isSubMenuVisible) // is sub menu on?
              {
                int iValue = g_Player.Volume;
                GUISliderControl pSlider = GetControl((int)Controls.OSD_AUDIOVOLUMESLIDER) as GUISliderControl;
                if (null != pSlider)
                {
                  pSlider.Percentage = iValue; // Update our volume slider accordingly ...
                }

                // set the controls values
                GUISliderControl pControl = (GUISliderControl)GetControl((int)Controls.OSD_AVDELAY);
                pControl.SpinType = GUISpinControl.SpinType.SPIN_CONTROL_TYPE_FLOAT;
                pControl.SetRange(-20, 20);
                SetSliderValue(-20, 20, m_audioDelay, (int)Controls.OSD_AVDELAY);

                bool hasPostProc = g_Player.HasPostprocessing;
                if (hasPostProc)
                {
                  GUIPropertyManager.SetProperty("#TvOSD.AudioVideoDelayPossible", "true");
                  pControl.FloatInterval = 1;
                }
                else
                { 
                  GUIPropertyManager.SetProperty("#TvOSD.AudioVideoDelayPossible", "false");
                  pControl.FloatValue = 0;
                  m_audioDelay = 0;
                  pControl.FloatInterval = 0;
                }

                // show the controls on this sub menu
                ShowControl(GetID, (int)Controls.OSD_AVDELAY);
                ShowControl(GetID, (int)Controls.OSD_AVDELAY_LABEL);
                ShowControl(GetID, (int)Controls.OSD_AUDIOSTREAM_LIST);
                ShowControl(GetID, (int)Controls.OSD_AUDIOVOLUMESLIDER);
                ShowControl(GetID, (int)Controls.OSD_AUDIOVOLUMESLIDER_LABEL);

                FocusControl(GetID, (int)Controls.OSD_AVDELAY, 0); // set focus to the first control in our group
                PopulateAudioStreams(); // populate the list control with audio streams for this video
              }
            }

            return true;
          }
      }
      return base.OnMessage(message);
    }
コード例 #16
0
 public IList<Card> ListAllEnabledCardsOrderedByPriority()
 {
   SqlBuilder sb = new SqlBuilder(StatementType.Select, typeof (Card));
   sb.AddConstraint("enabled=1");
   sb.AddOrderByField(false, "priority");
   SqlStatement stmt = sb.GetStatement(true);
   return ObjectFactory.GetCollection<Card>(stmt.Execute());
 }
コード例 #17
0
 public ChannelGroup CreateGroup(string groupName)
 {
   SqlBuilder sb = new SqlBuilder(StatementType.Select, typeof (ChannelGroup));
   sb.AddConstraint(Operator.Like, "groupName", "%" + groupName + "%");
   SqlStatement stmt = sb.GetStatement(true);
   IList<ChannelGroup> groups = ObjectFactory.GetCollection<ChannelGroup>(stmt.Execute());
   ChannelGroup group;
   int GroupSelected = 0;
   if (groups.Count == 0)
   {
     group = new ChannelGroup(groupName, 9999);
     group.Persist();
   }
   else
   {
     for (int i = 0; i < groups.Count; ++i)
     {
       if (groups[i].GroupName == groupName)
       {
         GroupSelected = i;
       }
     }
     group = groups[GroupSelected];
   }
   return group;
 }
コード例 #18
0
 public IList<ChannelLinkageMap> GetLinkagesForChannel(Channel channel)
 {
   IList<ChannelLinkageMap> pmap = channel.ReferringLinkedChannels();
   if (pmap != null)
   {
     if (pmap.Count > 0)
       return pmap;
   }
   SqlBuilder sb = new SqlBuilder(StatementType.Select, typeof (ChannelLinkageMap));
   sb.AddConstraint(Operator.Equals, "idLinkedChannel", channel.IdChannel);
   SqlStatement stmt = sb.GetStatement(true);
   return ObjectFactory.GetCollection<ChannelLinkageMap>(stmt.Execute());
 }
コード例 #19
0
 public Recording GetRecordingByFileName(string fileName)
 {
   SqlBuilder sb = new SqlBuilder(StatementType.Select, typeof (Recording));
   sb.AddConstraint(Operator.Equals, "fileName", fileName);
   sb.SetRowLimit(1);
   SqlStatement stmt = sb.GetStatement(true);
   IList<Recording> recordings = ObjectFactory.GetCollection<Recording>(stmt.Execute());
   if (recordings.Count == 0)
   {
     return null;
   }
   return recordings[0];
 }
コード例 #20
0
 public void RemoveOldPrograms(int idChannel)
 {
   SqlBuilder sb = new SqlBuilder(StatementType.Delete, typeof (Program));
   DateTime dtToKeep = DateTime.Now.AddHours(-EpgKeepDuration);
   IFormatProvider mmddFormat = new CultureInfo(String.Empty, false);
   sb.AddConstraint(Operator.Equals, "idChannel", idChannel);
   sb.AddConstraint(String.Format("endTime < '{0}'", dtToKeep.ToString(GetDateTimeString(), mmddFormat)));
   SqlStatement stmt = sb.GetStatement(true);
   ObjectFactory.GetCollection<Program>(stmt.Execute());
 }
コード例 #21
0
 public ChannelGroup GetGroupByName(string aGroupName, int aSortOrder)
 {
   SqlBuilder sb = new SqlBuilder(StatementType.Select, typeof (ChannelGroup));
   sb.AddConstraint(Operator.Like, "groupName", "%" + aGroupName + "%");
   // use like here since the user might have changed the casing
   if (aSortOrder > -1)
   {
     sb.AddConstraint(Operator.Equals, "sortOrder", aSortOrder);
   }
   SqlStatement stmt = sb.GetStatement(true);
   Log.Debug(stmt.Sql);
   IList<ChannelGroup> groups = ObjectFactory.GetCollection<ChannelGroup>(stmt.Execute());
   if (groups == null)
   {
     return null;
   }
   if (groups.Count == 0)
   {
     return null;
   }
   return groups[0];
 }
コード例 #22
0
 public void RemoveAllPrograms(int idChannel)
 {
   SqlBuilder sb = new SqlBuilder(StatementType.Delete, typeof (Program));
   sb.AddConstraint(Operator.Equals, "idChannel", idChannel);
   SqlStatement stmt = sb.GetStatement(true);
   ObjectFactory.GetCollection<Program>(stmt.Execute());
 }
コード例 #23
0
    public Channel GetChannel(int idChannel)
    {
      SqlBuilder sb = new SqlBuilder(StatementType.Select, typeof (Channel));
      sb.AddConstraint(Operator.Equals, "idChannel", idChannel);

      SqlStatement stmt = sb.GetStatement(true);
      IList<Channel> channels = ObjectFactory.GetCollection<Channel>(stmt.Execute());
      if (channels == null)
      {
        return null;
      }
      if (channels.Count == 0)
      {
        return null;
      }
      return channels[0];
    }
コード例 #24
0
 public IList<Program> GetOnairNow()
 {
   SqlBuilder sb = new SqlBuilder(StatementType.Select, typeof (Program));
   IFormatProvider mmddFormat = new CultureInfo(String.Empty, false);
   sb.AddConstraint(String.Format("startTime <= '{0}' and endTime >= '{1}'",
                                  DateTime.Now.ToString(GetDateTimeString(), mmddFormat),
                                  DateTime.Now.ToString(GetDateTimeString(), mmddFormat)));
   SqlStatement stmt = sb.GetStatement(true);
   return ObjectFactory.GetCollection<Program>(stmt.Execute());
 }
コード例 #25
0
    public TuningDetail GetTuningDetail(int networkId, int transportId, int serviceId, int channelType)
    {
      SqlBuilder sb = new SqlBuilder(StatementType.Select, typeof (TuningDetail));
      sb.AddConstraint(Operator.Equals, "networkId", networkId);
      sb.AddConstraint(Operator.Equals, "serviceId", serviceId);
      sb.AddConstraint(Operator.Equals, "transportId", transportId);
      sb.AddConstraint(Operator.Equals, "channelType", channelType);

      SqlStatement stmt = sb.GetStatement(true);
      IList<TuningDetail> details = ObjectFactory.GetCollection<TuningDetail>(stmt.Execute());

      if (details == null)
      {
        return null;
      }
      if (details.Count == 0)
      {
        return null;
      }
      return details[0];
    }
コード例 #26
0
    public IList<Program> GetPrograms(Channel channel, DateTime startTime)
    {
      //The DateTime.MinValue is lower than the min datetime value of the database
      if (startTime == DateTime.MinValue)
      {
        startTime = startTime.AddYears(1900);
      }
      IFormatProvider mmddFormat = new CultureInfo(String.Empty, false);
      SqlBuilder sb = new SqlBuilder(StatementType.Select, typeof (Program));

      sb.AddConstraint(Operator.Equals, "idChannel", channel.IdChannel);
      sb.AddConstraint(String.Format("startTime>='{0}'", startTime.ToString(GetDateTimeString(), mmddFormat)));
      sb.AddOrderByField(true, "startTime");

      SqlStatement stmt = sb.GetStatement(true);
      return ObjectFactory.GetCollection<Program>(stmt.Execute());
    }
コード例 #27
0
 public IList<Channel> GetChannelsByName(string name)
 {
   SqlBuilder sb = new SqlBuilder(StatementType.Select, typeof (Channel));
   sb.AddConstraint(Operator.Equals, "displayName", name);
   SqlStatement stmt = sb.GetStatement(true);
   IList<Channel> channels = ObjectFactory.GetCollection<Channel>(stmt.Execute());
   return channels;
 }
コード例 #28
0
 public DateTime GetNewestProgramForChannel(int idChannel)
 {
   SqlBuilder sb = new SqlBuilder(StatementType.Select, typeof (Program));
   sb.AddConstraint(Operator.Equals, "idChannel", idChannel);
   sb.AddOrderByField(false, "startTime");
   sb.SetRowLimit(1);
   SqlStatement stmt = sb.GetStatement(true);
   IList<Program> progs = ObjectFactory.GetCollection<Program>(stmt.Execute());
   return progs.Count > 0 ? progs[0].StartTime : DateTime.MinValue;
 }
コード例 #29
0
 public IList<Channel> GetAllRadioChannels()
 {
   SqlBuilder sb = new SqlBuilder(StatementType.Select, typeof (Channel));
   sb.AddConstraint(Operator.Equals, "isRadio", 1);
   SqlStatement stmt = sb.GetStatement(true);
   IList<Channel> radioChannels = ObjectFactory.GetCollection<Channel>(stmt.Execute());
   if (radioChannels == null)
   {
     return null;
   }
   if (radioChannels.Count == 0)
   {
     return null;
   }
   return radioChannels;
 }
コード例 #30
0
    public IList<Program> GetProgramsByTitle(Channel channel, DateTime startTime, DateTime endTime, string title)
    {
      IFormatProvider mmddFormat = new CultureInfo(String.Empty, false);
      SqlBuilder sb = new SqlBuilder(StatementType.Select, typeof (Program));

      string sub1 = String.Format("(EndTime > '{0}' and EndTime < '{1}')",
                                  startTime.ToString(GetDateTimeString(), mmddFormat),
                                  endTime.ToString(GetDateTimeString(), mmddFormat));
      string sub2 = String.Format("(StartTime >= '{0}' and StartTime <= '{1}')",
                                  startTime.ToString(GetDateTimeString(), mmddFormat),
                                  endTime.ToString(GetDateTimeString(), mmddFormat));
      string sub3 = String.Format("(StartTime <= '{0}' and EndTime >= '{1}')",
                                  startTime.ToString(GetDateTimeString(), mmddFormat),
                                  endTime.ToString(GetDateTimeString(), mmddFormat));

      sb.AddConstraint(Operator.Equals, "idChannel", channel.IdChannel);
      sb.AddConstraint(string.Format("({0} or {1} or {2}) ", sub1, sub2, sub3));
      sb.AddConstraint(Operator.Equals, "title", title);
      sb.AddOrderByField(true, "starttime");

      SqlStatement stmt = sb.GetStatement(true);
      return ObjectFactory.GetCollection<Program>(stmt.Execute());
    }