當前位置: 首頁>>代碼示例>>C#>>正文


C# TvBusinessLayer.GetSetting方法代碼示例

本文整理匯總了C#中TvDatabase.TvBusinessLayer.GetSetting方法的典型用法代碼示例。如果您正苦於以下問題:C# TvBusinessLayer.GetSetting方法的具體用法?C# TvBusinessLayer.GetSetting怎麽用?C# TvBusinessLayer.GetSetting使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在TvDatabase.TvBusinessLayer的用法示例。


在下文中一共展示了TvBusinessLayer.GetSetting方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: ActivePortsHandler_OnPowerSchedulerEvent

 private void ActivePortsHandler_OnPowerSchedulerEvent(PowerSchedulerEventArgs args)
 {
   switch (args.EventType)
   {
     case PowerSchedulerEventType.Started:
     case PowerSchedulerEventType.Elapsed:
       TvBusinessLayer layer = new TvBusinessLayer();
       _enabled = Convert.ToBoolean(layer.GetSetting("PowerSchedulerActivePortsHandlerEnabled", "true").Value);
       _useAwayMode = Convert.ToBoolean(layer.GetSetting("PowerSchedulerActivePortsHandlerAwayMode", "false").Value);
       break;
   }
 }
開發者ID:arangas,項目名稱:MediaPortal-1,代碼行數:12,代碼來源:ActivePortsHandler.cs

示例6: OnPageLoad

    protected override void OnPageLoad()
    {
      base.OnPageLoad();
      spinPreRecord.SetRange(0, 30);
      spinPostRecord.SetRange(0, 30);
      TvBusinessLayer layer = new TvBusinessLayer();

      spinPreRecord.Value = Int32.Parse(layer.GetSetting("preRecordInterval", "5").Value);
      spinPostRecord.Value = Int32.Parse(layer.GetSetting("postRecordInterval", "5").Value);

      cbAutoDeleteRecordings.Selected = (layer.GetSetting("autodeletewatchedrecordings", "no").Value == "yes");
      cbCreateTagInfoXML.Selected = (layer.GetSetting("createtaginfoxml", "yes").Value == "yes");
    }
開發者ID:arangas,項目名稱:MediaPortal-1,代碼行數:13,代碼來源:TvRecordingSettings.cs

示例7: TimeShifter

    /// <summary>
    /// Initializes a new instance of the <see cref="TimeShifter"/> class.
    /// </summary>
    /// <param name="cardHandler">The card handler.</param>
    public TimeShifter(ITvCardHandler cardHandler) : base(cardHandler)
    {
      

      _cardHandler = cardHandler;
      var layer = new TvBusinessLayer();
      _linkageScannerEnabled = (layer.GetSetting("linkageScannerEnabled", "no").Value == "yes");

      _linkageGrabber = new ChannelLinkageGrabber(cardHandler.Card);
      _timeshiftingEpgGrabberEnabled = (layer.GetSetting("timeshiftingEpgGrabberEnabled", "no").Value == "yes");

      _timeAudioEvent = DateTime.MinValue;
      _timeVideoEvent = DateTime.MinValue;
    }    
開發者ID:arangas,項目名稱:MediaPortal-1,代碼行數:18,代碼來源:TimeShifter.cs

示例8: 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

示例9: 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

示例10: 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

示例11: 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

示例12: 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

示例13: OnSectionDeActivated

    public override void OnSectionDeActivated()
    {
      base.OnSectionDeActivated();
      TvBusinessLayer layer = new TvBusinessLayer();

      Setting s = layer.GetSetting("generalEPGAlwaysFillHoles", "no");
      s.Value = checkBoxAlwaysFillHoles.Checked ? "yes" : "no";
      s.Persist();

      s = layer.GetSetting("generalEPGAlwaysReplace", "no");
      s.Value = checkBoxAlwaysUpdate.Checked ? "yes" : "no";
      s.Persist();

      s = layer.GetSetting("generalGrapOnlyForSameTransponder", "no");
      s.Value = checkboxSameTransponder.Checked ? "yes" : "no";
      s.Persist();

      DebugSettings.DisableCRCCheck = !checkBoxEnableCRCCheck.Checked;

      s = layer.GetSetting("idleEPGGrabberEnabled", "yes");
      s.Value = checkBoxEnableEPGWhileIdle.Checked ? "yes" : "no";
      s.Persist();

      s = layer.GetSetting("timeoutEPG", "10");
      s.Value = numericUpDownEpgTimeOut.Value.ToString();
      s.Persist();

      s = layer.GetSetting("timeoutEPGRefresh", "240");
      s.Value = numericUpDownEpgRefresh.Value.ToString();
      s.Persist();

      s = layer.GetSetting("timeshiftingEpgGrabberEnabled", "no");
      s.Value = checkBoxEnableEpgWhileTimeshifting.Checked ? "yes" : "no";
      s.Persist();

      s = layer.GetSetting("timeshiftingEpgGrabberTimeout", "2");
      s.Value = numericUpDownTSEpgTimeout.Value.ToString();
      s.Persist();

      s = layer.GetSetting("epgTitleTemplate", "%TITLE%");
      s.Value = edTitleTemplate.Text;
      s.Persist();

      s = layer.GetSetting("epgDescriptionTemplate", "%DESCRIPTION%");
      s.Value = edDescriptionTemplate.Text;
      s.Persist();
    }
開發者ID:arangas,項目名稱:MediaPortal-1,代碼行數:47,代碼來源:Epg.cs

示例14: AddSchedule

        public bool AddSchedule(int channelId, String programName, DateTime startTime, DateTime endTime, int scheduleType, Int32 priority, Int32 keepmethod, DateTime keepdate, Int32 preRecordInterval, Int32 postRecordInterval)
        {
            try
            {
                TvBusinessLayer layer = new TvBusinessLayer();

                TvDatabase.Schedule s = new TvDatabase.Schedule(channelId, programName, startTime, endTime);
                if (scheduleType < 0)
                {
                    s.ScheduleType = (int)TvDatabase.ScheduleRecordingType.Once;
                }
                else
                {
                    s.ScheduleType = scheduleType;
                }

                if (priority != -1)
                {
                    s.Priority = priority;
                }

                if (keepmethod != -1)
                {
                    s.KeepMethod = keepmethod;
                    s.KeepDate = keepdate;
                }

                if ((preRecordInterval < 0) && (postRecordInterval < 0))
                {   //Use the settings from Mediaportal
                    s.PreRecordInterval = Int32.Parse(layer.GetSetting("preRecordInterval", "5").Value);
                    s.PostRecordInterval = Int32.Parse(layer.GetSetting("postRecordInterval", "5").Value);
                }
                else
                {   // Use the settings from XBMC
                    s.PreRecordInterval = preRecordInterval;
                    s.PostRecordInterval = postRecordInterval;
                }
                s.Persist();
                RemoteControl.Instance.OnNewSchedule();

                return true;
            }
            catch
            {
                return false;
            }
        }
開發者ID:margro,項目名稱:TVServerXBMC,代碼行數:47,代碼來源:ServerInterface.cs

示例15: 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


注:本文中的TvDatabase.TvBusinessLayer.GetSetting方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。