当前位置: 首页>>代码示例>>C#>>正文


C# TvBusinessLayer.GetChannelsByName方法代码示例

本文整理汇总了C#中TvDatabase.TvBusinessLayer.GetChannelsByName方法的典型用法代码示例。如果您正苦于以下问题:C# TvBusinessLayer.GetChannelsByName方法的具体用法?C# TvBusinessLayer.GetChannelsByName怎么用?C# TvBusinessLayer.GetChannelsByName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TvDatabase.TvBusinessLayer的用法示例。


在下文中一共展示了TvBusinessLayer.GetChannelsByName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: LoadSettings

    private void LoadSettings()
    {
      using (Settings xmlreader = new MPSettings())
      {
        String channelName = xmlreader.GetValueAsString("radioguide", "channel", String.Empty);
        TvBusinessLayer layer = new TvBusinessLayer();
        IList<Channel> channels = layer.GetChannelsByName(channelName);
        if (channels != null && channels.Count > 0)
        {
          _currentChannel = channels[0];
        }
        _cursorX = xmlreader.GetValueAsInt("radioguide", "ypos", 0);
        ChannelOffset = xmlreader.GetValueAsInt("radioguide", "yoffset", 0);
        _byIndex = xmlreader.GetValueAsBool("myradio", "byindex", true);
        _showChannelNumber = xmlreader.GetValueAsBool("myradio", "showchannelnumber", false);
        _channelNumberMaxLength = xmlreader.GetValueAsInt("myradio", "channelnumbermaxlength", 3);
        _timePerBlock = xmlreader.GetValueAsInt("radioguide", "timeperblock", 30);
        _hdtvProgramText = xmlreader.GetValueAsString("myradio", "hdtvProgramText", "(HDTV)");
        _guideContinuousScroll = xmlreader.GetValueAsBool("myradio", "continuousScrollGuide", false);
        _loopDelay = xmlreader.GetValueAsInt("gui", "listLoopDelay", 0);
      }

      // Load settings defined by the skin.
      LoadSkinSettings();

      // Load genre colors.
      // If guide colors have not been loaded then attempt to load guide colors.

      // this is just for the border highlight in radio EPG

      if (!_guideColorsLoaded)
      {
        using (Settings xmlreader = new SKSettings())
        {
          _guideColorsLoaded = LoadGuideColors(xmlreader);
        }
      }

      _useNewRecordingButtonColor =
        Utils.FileExistsInCache(GUIGraphicsContext.GetThemedSkinFile(@"\media\tvguide_recButton_Focus_middle.png"));
      _useNewPartialRecordingButtonColor =
        Utils.FileExistsInCache(GUIGraphicsContext.GetThemedSkinFile(@"\media\tvguide_partRecButton_Focus_middle.png"));
      _useNewNotifyButtonColor =
        Utils.FileExistsInCache(GUIGraphicsContext.GetThemedSkinFile(@"\media\tvguide_notifyButton_Focus_middle.png"));
      _useHdProgramIcon =
        Utils.FileExistsInCache(GUIGraphicsContext.GetThemedSkinFile(@"\media\tvguide_hd_program.png"));
    }
开发者ID:arangas,项目名称:MediaPortal-1,代码行数:47,代码来源:RadioGuideBase.cs

示例2: LoadSettings

 private void LoadSettings()
 {
   using (Settings xmlreader = new MPSettings())
   {
     String channelName = xmlreader.GetValueAsString("radioguide", "channel", String.Empty);
     TvBusinessLayer layer = new TvBusinessLayer();
     IList<Channel> channels = layer.GetChannelsByName(channelName);
     if (channels != null && channels.Count > 0)
     {
       _currentChannel = channels[0];
     }
     _cursorX = xmlreader.GetValueAsInt("radioguide", "ypos", 0);
     ChannelOffset = xmlreader.GetValueAsInt("radioguide", "yoffset", 0);
     _byIndex = xmlreader.GetValueAsBool("myradio", "byindex", true);
     _showChannelNumber = xmlreader.GetValueAsBool("myradio", "showchannelnumber", false);
     _channelNumberMaxLength = xmlreader.GetValueAsInt("myradio", "channelnumbermaxlength", 3);
     _timePerBlock = xmlreader.GetValueAsInt("radioguide", "timeperblock", 30);
     _hdtvProgramText = xmlreader.GetValueAsString("myradio", "hdtvProgramText", "(HDTV)");
     _guideContinuousScroll = xmlreader.GetValueAsBool("myradio", "continuousScrollGuide", false);
     _loopDelay = xmlreader.GetValueAsInt("gui", "listLoopDelay", 0);
   }
   _useNewRecordingButtonColor =
     Utils.FileExistsInCache(Path.Combine(GUIGraphicsContext.Skin, @"media\tvguide_recButton_Focus_middle.png"));
   _useNewPartialRecordingButtonColor =
     Utils.FileExistsInCache(Path.Combine(GUIGraphicsContext.Skin, @"media\tvguide_partRecButton_Focus_middle.png"));
   _useNewNotifyButtonColor =
     Utils.FileExistsInCache(Path.Combine(GUIGraphicsContext.Skin, @"media\tvguide_notifyButton_Focus_middle.png"));
   _useHdProgramIcon =
     Utils.FileExistsInCache(Path.Combine(GUIGraphicsContext.Skin, @"media\tvguide_hd_program.png"));
 }
开发者ID:djblu,项目名称:MediaPortal-1,代码行数:30,代码来源:RadioGuideBase.cs

示例3: importButton_Click

    private void importButton_Click(object sender, EventArgs e)
    {
      bool importtv = imCheckTvChannels.Checked;
      bool importtvgroups = imCheckTvGroups.Checked;
      bool importradio = imCheckRadioChannels.Checked;
      bool importradiogroups = imCheckRadioGroups.Checked;
      bool importschedules = imCheckSchedules.Checked;

      openFileDialog1.CheckFileExists = true;
      openFileDialog1.DefaultExt = "xml";
      openFileDialog1.RestoreDirectory = true;
      openFileDialog1.Title = "Load channels, channel groups and schedules";
      openFileDialog1.InitialDirectory = String.Format(@"{0}\Team MediaPortal\MediaPortal TV Server",
                                                       Environment.GetFolderPath(
                                                         Environment.SpecialFolder.CommonApplicationData));
      openFileDialog1.FileName = "export.xml";
      openFileDialog1.AddExtension = true;
      openFileDialog1.Multiselect = false;
      if (openFileDialog1.ShowDialog(this) != DialogResult.OK)
        return;
      NotifyForm dlg = new NotifyForm("Importing tv channels...", "This can take some time\n\nPlease be patient...");
      try
      {
        dlg.Show();
        dlg.WaitForDisplay();
        CountryCollection collection = new CountryCollection();
        TvBusinessLayer layer = new TvBusinessLayer();
        bool mergeChannels = false; // every exported channel will be imported on its own.
        int channelCount = 0;
        int scheduleCount = 0;
        int tvChannelGroupCount = 0;
        int radioChannelGroupCount = 0;

        if (layer.Channels.Count > 0 && (importtv || importradio))
        {
          // rtv: we could offer to set a "merge" property here so tuningdetails would be updated for existing channels.
          if (
            MessageBox.Show(
              "Existing channels detected! \nIf you continue to import your old backup then all identically named channels will be treated equal - there is a risk of duplicate entries. \nDo you really want to go on?",
              "Channels found", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.Cancel)
            return;
          else
            mergeChannels = true;
        }

        XmlDocument doc = new XmlDocument();
        Log.Info("TvChannels: Trying to import channels from {0}", openFileDialog1.FileName);
        doc.Load(openFileDialog1.FileName);
        XmlNodeList channelList = doc.SelectNodes("/tvserver/channels/channel");
        XmlNodeList tvChannelGroupList = doc.SelectNodes("/tvserver/channelgroups/channelgroup");
        XmlNodeList radioChannelGroupList = doc.SelectNodes("/tvserver/radiochannelgroups/radiochannelgroup");
        XmlNodeList scheduleList = doc.SelectNodes("/tvserver/schedules/schedule");
        if (channelList != null)
        {
          foreach (XmlNode nodeChannel in channelList)
          {
            try
            {
              Channel dbChannel;
              XmlNodeList tuningList = nodeChannel.SelectNodes("TuningDetails/tune");
              XmlNodeList mappingList = nodeChannel.SelectNodes("mappings/map");
              bool grabEpg = (GetNodeAttribute(nodeChannel, "GrabEpg", "True") == "True");
              bool isRadio = (GetNodeAttribute(nodeChannel, "IsRadio", "False") == "True");
              bool isTv = (GetNodeAttribute(nodeChannel, "IsTv", "True") == "True");
              DateTime lastGrabTime = DateTime.ParseExact(GetNodeAttribute(nodeChannel, "LastGrabTime", "01.01.1900"),
                                                          "yyyy-M-d H:m:s", CultureInfo.InvariantCulture);
              int sortOrder = Int32.Parse(GetNodeAttribute(nodeChannel, "SortOrder", "0"));
              int timesWatched = Int32.Parse(GetNodeAttribute(nodeChannel, "TimesWatched", "0"));
              DateTime totalTimeWatched =
                DateTime.ParseExact(GetNodeAttribute(nodeChannel, "TotalTimeWatched", "01.01.1900"), "yyyy-M-d H:m:s",
                                    CultureInfo.InvariantCulture);
              bool visibileInGuide = (GetNodeAttribute(nodeChannel, "VisibleInGuide", "True") == "True");
              bool FreeToAir = (GetNodeAttribute(nodeChannel, "FreeToAir", "True") == "True");
              string displayName = GetNodeAttribute(nodeChannel, "DisplayName", "Unkown");
              int chChannelNumber = Int32.Parse(GetNodeAttribute(nodeChannel, "ChannelNumber", "10000"));

              // Only import TV or radio channels if the corresponding checkbox was checked
              if ((isTv && !importtv) || (isRadio && !importradio))
                continue;

              channelCount++;

              // rtv: since analog allows NOT to merge channels we need to take care of this. US users e.g. have multiple stations named "Sport" with different tuningdetails.
              // using AddChannel would incorrectly "merge" these totally different channels.
              // see this: http://forum.team-mediaportal.com/1-0-rc1-svn-builds-271/importing-exported-channel-list-groups-channels-39368/
              Log.Info("TvChannels: Adding {0}. channel: {1}", channelCount, displayName);
              IList<Channel> foundExistingChannels = layer.GetChannelsByName(displayName);
              if (mergeChannels && (foundExistingChannels != null && foundExistingChannels.Count > 0))
              {
                dbChannel = foundExistingChannels[0];
              }
              else
              {
                dbChannel = layer.AddNewChannel(displayName, chChannelNumber);
              }

              dbChannel.GrabEpg = grabEpg;
              dbChannel.IsRadio = isRadio;
              dbChannel.IsTv = isTv;
              dbChannel.LastGrabTime = lastGrabTime;
//.........这里部分代码省略.........
开发者ID:nio22,项目名称:MediaPortal-1,代码行数:101,代码来源:ImportExport.cs

示例4: LoadSettings

    private void LoadSettings()
    {
      using (Settings xmlreader = new MPSettings())
      {
        String channelName = xmlreader.GetValueAsString("mytv", "channel", String.Empty);
        TvBusinessLayer layer = new TvBusinessLayer();
        IList<Channel> channels = layer.GetChannelsByName(channelName);
        if (channels != null && channels.Count > 0)
        {
          _currentChannel = channels[0];
        }
        PositionGuideCursorToCurrentChannel();

        _byIndex = xmlreader.GetValueAsBool("mytv", "byindex", true);
        _showChannelNumber = xmlreader.GetValueAsBool("mytv", "showchannelnumber", false);
        _channelNumberMaxLength = xmlreader.GetValueAsInt("mytv", "channelnumbermaxlength", 3);
        _timePerBlock = xmlreader.GetValueAsInt("tvguide", "timeperblock", 30);
        _hdtvProgramText = xmlreader.GetValueAsString("mytv", "hdtvProgramText", "(HDTV)");
        _guideContinuousScroll = xmlreader.GetValueAsBool("mytv", "continuousScrollGuide", false);
        _loopDelay = xmlreader.GetValueAsInt("gui", "listLoopDelay", 0);

        // Load the genre map.
        if (_genreMap.Count == 0)
        {
          LoadGenreMap(xmlreader);
        }

        // Special genre rules.
        _specifyMpaaRatedAsMovie = xmlreader.GetValueAsBool("genreoptions", "specifympaaratedasmovie", false);
      }

      // Load settings defined by the skin.
      LoadSkinSettings();

      // Load genre colors.
      // If guide colors have not been loaded then attempt to load guide colors.
      if (!_guideColorsLoaded)
      {
        using (Settings xmlreader = new SKSettings())
        {
          _guideColorsLoaded = LoadGuideColors(xmlreader);
        }
      }

      _useNewRecordingButtonColor =
        Utils.FileExistsInCache(GUIGraphicsContext.GetThemedSkinFile(@"\media\tvguide_recButton_Focus_middle.png"));
      _useNewPartialRecordingButtonColor =
        Utils.FileExistsInCache(GUIGraphicsContext.GetThemedSkinFile(@"\media\tvguide_partRecButton_Focus_middle.png"));
      _useNewNotifyButtonColor =
        Utils.FileExistsInCache(GUIGraphicsContext.GetThemedSkinFile(@"\media\tvguide_notifyButton_Focus_middle.png"));
      _useHdProgramIcon =
        Utils.FileExistsInCache(GUIGraphicsContext.GetThemedSkinFile(@"\media\tvguide_hd_program.png"));
    }
开发者ID:gbminnock,项目名称:MediaPortal-1,代码行数:53,代码来源:TvGuideBase.cs


注:本文中的TvDatabase.TvBusinessLayer.GetChannelsByName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。