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


C# TvDatabase.TvBusinessLayer类代码示例

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


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

示例1: OnSectionActivated

 public override void OnSectionActivated()
 {
   _needRestart = false;
   _ignoreEvents = true;
   TvBusinessLayer layer = new TvBusinessLayer();
   base.OnSectionActivated();
   listView1.Items.Clear();
   ListViewGroup listGroup = listView1.Groups["listViewGroupAvailable"];
   foreach (ITvServerPlugin plugin in _loader.Plugins)
   {
     ListViewItem item = listView1.Items.Add("");
     item.Group = listGroup;
     item.SubItems.Add(plugin.Name);
     item.SubItems.Add(plugin.Author);
     item.SubItems.Add(plugin.Version);
     Setting setting = layer.GetSetting(String.Format("plugin{0}", plugin.Name), "false");
     item.Checked = setting.Value == "true";
     item.Tag = setting;
   }
   listGroup = listView1.Groups["listViewGroupIncompatible"];
   foreach (Type plugin in _loader.IncompatiblePlugins)
   {
     ListViewItem item = listView1.Items.Add("");
     item.Group = listGroup;
     item.SubItems.Add(plugin.Name);
     item.SubItems.Add("Unknown");
     item.SubItems.Add(plugin.Assembly.GetName().Version.ToString());
     item.Checked = false;
   }
   listView1.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);
   _ignoreEvents = false;
 }
开发者ID:npcomplete111,项目名称:MediaPortal-1,代码行数:32,代码来源:Plugins.cs

示例2: PersistPortalChannel

 private static void PersistPortalChannel(PortalChannel pChannel)
 {
   TvBusinessLayer layer = new TvBusinessLayer();
   Channel dbPortalChannel = layer.GetChannelByTuningDetail(pChannel.NetworkId, pChannel.TransportId,
                                                            pChannel.ServiceId);
   if (dbPortalChannel == null)
   {
     Log.Info("Portal channel with networkId={0}, transportId={1}, serviceId={2} not found", pChannel.NetworkId,
              pChannel.TransportId, pChannel.ServiceId);
     return;
   }
   Gentle.Framework.Broker.Execute("delete from ChannelLinkageMap WHERE idPortalChannel=" + dbPortalChannel.IdChannel);
   foreach (LinkedChannel lChannel in pChannel.LinkedChannels)
   {
     Channel dbLinkedChannnel = layer.GetChannelByTuningDetail(lChannel.NetworkId, lChannel.TransportId,
                                                               lChannel.ServiceId);
     if (dbLinkedChannnel == null)
     {
       Log.Info("Linked channel with name={0}, networkId={1}, transportId={2}, serviceId={3} not found",
                lChannel.Name, lChannel.NetworkId, lChannel.TransportId, lChannel.ServiceId);
       continue;
     }
     dbLinkedChannnel.DisplayName = lChannel.Name;
     dbLinkedChannnel.Persist();
     ChannelLinkageMap map = new ChannelLinkageMap(dbPortalChannel.IdChannel, dbLinkedChannnel.IdChannel,
                                                   lChannel.Name);
     map.Persist();
   }
 }
开发者ID:arangas,项目名称:MediaPortal-1,代码行数:29,代码来源:ChannelLinkageGrabber.cs

示例3: CardAllocationBase

 protected CardAllocationBase(TvBusinessLayer businessLayer, IController controller)
 {      
   _businessLayer = businessLayer;
   _controller = controller;
   //_tuningChannelMapping = new Dictionary<int, IList<IChannel>>();
   //_channelMapping = new Dictionary<int, bool>();
 }
开发者ID:sanyaade-embedded-systems,项目名称:MediaPortal-1,代码行数:7,代码来源:CardAllocationBase.cs

示例4: LoadLanguages

    private void LoadLanguages()
    {
      _loaded = true;
      mpListView2.BeginUpdate();
      try
      {
        mpListView2.Items.Clear();
        List<KeyValuePair<String, String>> languages = TvLibrary.Epg.Languages.Instance.GetLanguagePairs();

        TvBusinessLayer layer = new TvBusinessLayer();
        Setting setting = layer.GetSetting(languagesSettingsKey);
        foreach (KeyValuePair<String, String> language in languages)
        {
          ListViewItem item = new ListViewItem(new string[] { language.Value, language.Key });
          mpListView2.Items.Add(item);
          item.Tag = language.Key;
          item.Checked = setting.Value.IndexOf((string)item.Tag) >= 0;
        }
        mpListView2.Sort();

      }
      finally
      {
        mpListView2.EndUpdate();
      }
    }
开发者ID:arangas,项目名称:MediaPortal-1,代码行数:26,代码来源:EpgGrabber.cs

示例5: DoCopy

    public void DoCopy()
    {
      try
      {
        string baseTs = Path.GetDirectoryName(_fileStart) + "\\" +
                        Path.GetFileNameWithoutExtension(_fileStart).Substring(0, 19);
        Log.Info("TsCopier: baseTs: {0}", baseTs);
        int idCurrent = Int32.Parse(Path.GetFileNameWithoutExtension(_fileStart).Remove(0, 19));
        int idStart = idCurrent;
        int idStop = Int32.Parse(Path.GetFileNameWithoutExtension(_fileEnd).Remove(0, 19));
        TvBusinessLayer layer = new TvBusinessLayer();
        decimal maxFiles = Convert.ToDecimal(layer.GetSetting("timeshiftMaxFiles", "20").Value);
        Log.Info("TsCopier: baseTs={0} idCurrent={1} idStop={2} maxFiles={3}", baseTs, idCurrent, idStop, maxFiles);
        Directory.CreateDirectory(Path.GetDirectoryName(_recording) + "\\" +
                                  Path.GetFileNameWithoutExtension(_recording) + "_tsbuffers");
        int cycles = 1;
        if (idStop > idStart)
          cycles = (idStop - idStart) + 1;
        else if (idStop < idStart)
          cycles = (int)(maxFiles - idStart) + 1 + idStop;
        for (int i = idStart; i <= cycles; i++)
        {
          string currentSourceBuffer = baseTs + idCurrent.ToString() + ".ts";
          string targetTs = Path.GetDirectoryName(_recording) + "\\" + Path.GetFileNameWithoutExtension(_recording) +
                            "_tsbuffers\\" + Path.GetFileName(currentSourceBuffer);
          Log.Info("TsCopier: Copying - source: {0}, target: {1}", currentSourceBuffer, targetTs);
          FileStream reader = new FileStream(currentSourceBuffer, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
          FileStream writer = new FileStream(targetTs, FileMode.CreateNew, FileAccess.Write);

          reader.Seek(_posStart, SeekOrigin.Begin);
          byte[] buf = new byte[1024];
          int bytesRead = reader.Read(buf, 0, 1024);
          while (bytesRead > 0)
          {
            if (reader.Position > _posEnd && currentSourceBuffer == _fileEnd)
              bytesRead -= (int)(reader.Position - _posEnd);
            if (bytesRead <= 0)
              break;
            writer.Write(buf, 0, bytesRead);
            bytesRead = reader.Read(buf, 0, 1024);
          }
          writer.Flush();
          writer.Close();
          writer.Dispose();
          writer = null;
          reader.Close();
          reader.Dispose();
          reader = null;
          Log.Info("TsCopier: copying done.");
          idCurrent++;
          if (idCurrent > maxFiles)
            idCurrent = 1;
        }
        Log.Info("TsCopier: processed all timeshift buffer files for recording.");
      }
      catch (Exception ex)
      {
        Log.Write(ex);
      }
    }
开发者ID:arangas,项目名称:MediaPortal-1,代码行数:60,代码来源:TsCopier.cs

示例6: TVAccessService

        public TVAccessService()
        {
            _tvBusiness = new TvBusinessLayer();

            // try to initialize Gentle and TVE API
            InitializeGentleAndTVE();
        }
开发者ID:WillStefan,项目名称:MPExtended,代码行数:7,代码来源:TVAccessService.cs

示例7: GetNextWakeupTime

    public DateTime GetNextWakeupTime(DateTime earliestWakeupTime)
    {
      TvBusinessLayer layer = new TvBusinessLayer();
      bool remoteSchedulerEnabled = (layer.GetSetting("xmlTvRemoteSchedulerEnabled", "false").Value == "true");
      if (!remoteSchedulerEnabled)
      {
        return DateTime.MaxValue;
      }

      DateTime now = DateTime.Now;
      DateTime defaultRemoteScheduleTime = new DateTime(now.Year, now.Month, now.Day, 0, 0, 0);
      string remoteScheduleTimeStr =
        layer.GetSetting("xmlTvRemoteScheduleTime", defaultRemoteScheduleTime.ToString()).Value;

      DateTime remoteScheduleTime =
        (DateTime)
        (System.ComponentModel.TypeDescriptor.GetConverter(new DateTime(now.Year, now.Month, now.Day)).ConvertFrom(
          remoteScheduleTimeStr));

      if (remoteScheduleTime == DateTime.MinValue)
      {
        remoteScheduleTime = defaultRemoteScheduleTime;
      }

      if ((now < remoteScheduleTime) && (remoteScheduleTime > DateTime.MinValue))
      {
        remoteScheduleTime.AddDays(1);
      }

      Log.Debug(this._handlerName + ".GetNextWakeupTime {0}", remoteScheduleTime);

      remoteScheduleTime.AddMinutes(-1); // resume 60sec before      

      return remoteScheduleTime;
    }
开发者ID:arangas,项目名称:MediaPortal-1,代码行数:35,代码来源:XmlTvImportWakeupHandler.cs

示例8: OnSectionActivated

    public override void OnSectionActivated()
    {
      _cards = Card.ListAll();
      base.OnSectionActivated();
      mpGroupBox1.Visible = false;
      RemoteControl.Instance.EpgGrabberEnabled = true;

      comboBoxGroups.Items.Clear();
      IList<ChannelGroup> groups = ChannelGroup.ListAll();
      foreach (ChannelGroup group in groups)
        comboBoxGroups.Items.Add(new ComboBoxExItem(group.GroupName, -1, group.IdGroup));
      if (comboBoxGroups.Items.Count == 0)
        comboBoxGroups.Items.Add(new ComboBoxExItem("(no groups defined)", -1, -1));
      comboBoxGroups.SelectedIndex = 0;

      timer1.Enabled = true;

      mpListView1.Items.Clear();

      buttonRestart.Visible = false;
      mpButtonRec.Enabled = false;

      TvBusinessLayer layer = new TvBusinessLayer();
      if (layer.GetSetting("idleEPGGrabberEnabled", "yes").Value != "yes")
      {
        mpButtonReGrabEpg.Enabled = false;
      }

      _channelNames = new Dictionary<int, string>();
      IList<Channel> channels = Channel.ListAll();
      foreach (Channel ch in channels)
      {
        _channelNames.Add(ch.IdChannel, ch.DisplayName);
      }
    }
开发者ID:npcomplete111,项目名称:MediaPortal-1,代码行数:35,代码来源:TestService.cs

示例9: LoadLanguages

    private void LoadLanguages()
    {
      _loaded = true;
      mpListView2.BeginUpdate();
      try
      {
        mpListView2.Items.Clear();
        TvLibrary.Epg.Languages languages = new TvLibrary.Epg.Languages();
        List<String> codes = languages.GetLanguageCodes();
        List<String> list = languages.GetLanguages();

        TvBusinessLayer layer = new TvBusinessLayer();
        Setting setting = layer.GetSetting(languagesSettingsKey);

        for (int j = 0; j < list.Count; j++)
        {
          ListViewItem item = new ListViewItem(new string[] { list[j], codes[j] });
          mpListView2.Items.Add(item);
          item.Tag = codes[j];
          item.Checked = setting.Value.IndexOf((string)item.Tag) >= 0;
        }
        mpListView2.Sort();

      }
      finally
      {
        mpListView2.EndUpdate();
      }
    }
开发者ID:nio22,项目名称:MediaPortal-1,代码行数:29,代码来源:EpgGrabber.cs

示例10: LoadSettings

    public override void LoadSettings()
    {
      var layer = new TvBusinessLayer();      
      numEpgGrabber.Value = ValueSanityCheck(
        Convert.ToDecimal(layer.GetSetting(UserFactory.EPG_TAGNAME, UserFactory.EPG_PRIORITY.ToString()).Value), 1, 100);

      numDefaultUser.Value = ValueSanityCheck(
        Convert.ToDecimal(layer.GetSetting(UserFactory.USER_TAGNAME, UserFactory.USER_PRIORITY.ToString()).Value), 1, 100);

      numScheduler.Value = ValueSanityCheck(
        Convert.ToDecimal(layer.GetSetting(UserFactory.SCHEDULER_TAGNAME, UserFactory.SCHEDULER_PRIORITY.ToString()).Value), 1, 100);

      numVirtualuser.Value = Convert.ToInt32(layer.GetSetting("VirtualUserIdleTime", "5").Value);

      Setting setting = layer.GetSetting(UserFactory.CUSTOM_TAGNAME, "");
      gridUserPriorities.Rows.Clear();
      string[] users = setting.Value.Split(';');
      foreach (string user in users)
      {
        string[] shareItem = user.Split(',');
        if ((shareItem.Length.Equals(2)) &&
            ((shareItem[0].Trim().Length > 0) ||
             (shareItem[1].Trim().Length > 0)))
        {
          gridUserPriorities.Rows.Add(shareItem);
        }
      }
    }
开发者ID:Eddie-Jee,项目名称:MediaPortal-1,代码行数:28,代码来源:UserPriorities.cs

示例11: TvWishListSetup

        public TvWishListSetup()
        {
            InitializeComponent();

            myTvWishes = new TvWishProcessing();
            PluginGuiLocalizeStrings.LoadMPlanguage();
            //initialize TV database
            myinterface = new ServiceInterface();
            //try to shorten wait time when switching to the page by opening the connection at the beginning
            myinterface.ConnectToDatabase();

            TvBusinessLayer layer = new TvBusinessLayer();
            Setting setting;
            //default pre and post record from general recording settings
            setting = layer.GetSetting("preRecordInterval", "5");
            prerecord = setting.Value;

            setting = layer.GetSetting("postRecordInterval", "5");
            postrecord = setting.Value;

            IList<Channel> allChannels = Channel.ListAll();
            IList<ChannelGroup> allChannelGroups = ChannelGroup.ListAll();
            IList<RadioChannelGroup> allRadioChannelGroups = RadioChannelGroup.ListAll();
            IList<Card> allCards = Card.ListAll();

            Log.Debug("allCards.Count=" + allCards.Count.ToString());

            myTvWishes.TvServerSettings(prerecord, postrecord, allChannelGroups, allRadioChannelGroups, allChannels, allCards, TvWishItemSeparator);

            LanguageTranslation();

            LoadSettings();

        }
开发者ID:huha001,项目名称:TvWishList,代码行数:34,代码来源:Setup.cs

示例12: LoadSettings

 private void LoadSettings()
 {
   TvBusinessLayer layer = new TvBusinessLayer();
   double timeout;
   if (!double.TryParse(layer.GetSetting("timeshiftingEpgGrabberTimeout", "2").Value, out timeout))
     timeout = 2;
   _epgTimer.Interval = timeout * 60000;
 }
开发者ID:npcomplete111,项目名称:MediaPortal-1,代码行数:8,代码来源:TimeShiftingEPGGrabber.cs

示例13: TVAccessService

        public TVAccessService()
        {
            _tvUsers = new Dictionary<string, IUser>();
            _tvBusiness = new TvBusinessLayer();

            // try to initialize Gentle and TVE API
            InitializeGentleAndTVE();
        }
开发者ID:Thorsten1982,项目名称:MPExtended,代码行数:8,代码来源:TVAccessService.cs

示例14: buttonOk_Click

    private void buttonOk_Click(object sender, EventArgs e)
    {
      if (textBoxName.Text.Length == 0)
      {
        MessageBox.Show("Please enter a name for this channel");
        return;
      }
      int channelNumber;
      if (!Int32.TryParse(textBoxChannelNumber.Text, out channelNumber))
      {
        MessageBox.Show(this, "Please enter a valid channel number!", "Incorrect input");
        return;
      }
      if (channelNumber < 0)
      {
        MessageBox.Show(this, "Please enter a positive channel number!", "Incorrect input");
        return;
      }
      _channel.DisplayName = textBoxName.Text;
      _channel.ChannelNumber = channelNumber;
      _channel.VisibleInGuide = checkBoxVisibleInTvGuide.Checked;
      _channel.IsTv = _isTv;
      _channel.IsRadio = !_isTv;
      _channel.Persist();
      if (_newChannel)
      {
        TvBusinessLayer layer = new TvBusinessLayer();
        if (_isTv)
        {
          layer.AddChannelToGroup(_channel, TvConstants.TvGroupNames.AllChannels);
        }
        else
        {
          layer.AddChannelToRadioGroup(_channel, TvConstants.RadioGroupNames.AllChannels);
        }
      }
      foreach (TuningDetail detail in _tuningDetails)
      {
        detail.IdChannel = _channel.IdChannel;
        detail.IsRadio = !_isTv;
        detail.IsTv = _isTv;
        if (string.IsNullOrEmpty(detail.Name))
        {
          detail.Name = _channel.DisplayName;
        }
        detail.Persist();
      }

      foreach (TuningDetail detail in _tuningDetailsToDelete)
      {
        detail.Remove();
      }


      DialogResult = DialogResult.OK;
      Close();
    }
开发者ID:arangas,项目名称:MediaPortal-1,代码行数:57,代码来源:FormEditChannel.cs

示例15: Recorder

    private ITvSubChannel _subchannel; // the active sub channel to record

    /// <summary>
    /// Initializes a new instance of the <see cref="Recording"/> class.
    /// </summary>
    /// <param name="cardHandler">The card handler.</param>
    public Recorder(ITvCardHandler cardHandler)
    {
      _eventAudio = new ManualResetEvent(false);
      _eventVideo = new ManualResetEvent(false);

      TvBusinessLayer layer = new TvBusinessLayer();
      _cardHandler = cardHandler;
      _timeshiftingEpgGrabberEnabled = (layer.GetSetting("timeshiftingEpgGrabberEnabled", "no").Value == "yes");
      _waitForTimeshifting = Int32.Parse(layer.GetSetting("timeshiftWaitForTimeshifting", "15").Value);
    }
开发者ID:npcomplete111,项目名称:MediaPortal-1,代码行数:16,代码来源:Recorder.cs


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