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


C# TvBusinessLayer.AddCard方法代碼示例

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


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

示例1: Main

    static void Main(string[] args)
    {
      TvBusinessLayer layer = new TvBusinessLayer();
      layer.AddCard("name1", "path1", 1);
      layer.AddCard("name2", "path2", 2);
      layer.AddCard("name3", "path3", 3);
      layer.AddCard("name4", "path4", 4);

      Card card = layer.GetCardByName("name2");
      card = layer.GetCardByDevicePath("path4");

      Channel channel = layer.AddChannel("provider", "name");
      channel = layer.AddChannel("provider", "name");
      

      DatabaseManager.Instance.SaveChanges();

    }
開發者ID:arangas,項目名稱:MediaPortal-1,代碼行數:18,代碼來源:Program.cs

示例2: InitController


//.........這裏部分代碼省略.........
            Log.Info("Controller: new server created for {0} master:{1} ", Dns.GetHostName(), _isMaster);
          }
          else
          {
            Log.Error(
              "Controller: sorry, master/slave server setups are not supported. Since there is already another server in the db, we exit here.");
            return false;
          }
        }
        _isMaster = _ourServer.IsMaster;

        //enumerate all tv cards in this pc...
        TvBusinessLayer layer = new TvBusinessLayer();

        _maxFreeCardsToTry = Int32.Parse(layer.GetSetting("timeshiftMaxFreeCardsToTry", "0").Value);

        for (int i = 0; i < _localCardCollection.Cards.Count; ++i)
        {
          //for each card, check if its already mentioned in the database
          bool found = false;
          IList<Card> cards = _ourServer.ReferringCard();
          foreach (Card card in cards)
          {
            if (card.DevicePath == _localCardCollection.Cards[i].DevicePath)
            {
              found = true;
              break;
            }
          }
          if (!found)
          {
            // card is not yet in the database, so add it
            Log.Info("Controller: add card:{0}", _localCardCollection.Cards[i].Name);
            layer.AddCard(_localCardCollection.Cards[i].Name, _localCardCollection.Cards[i].DevicePath, _ourServer);
          }
        }
        //notify log about cards from the database which are removed from the pc
        IList<Card> cardsInDbs = Card.ListAll();
        int cardsInstalled = _localCardCollection.Cards.Count;
        foreach (Card dbsCard in cardsInDbs)
        {
          if (dbsCard.ReferencedServer().IdServer == _ourServer.IdServer)
          {
            bool found = false;
            for (int cardNumber = 0; cardNumber < cardsInstalled; ++cardNumber)
            {
              if (dbsCard.DevicePath == _localCardCollection.Cards[cardNumber].DevicePath)
              {
                Card cardDB = layer.GetCardByDevicePath(_localCardCollection.Cards[cardNumber].DevicePath);

                bool cardEnabled = cardDB.Enabled;
                bool cardPresent = _localCardCollection.Cards[cardNumber].CardPresent;

                if (cardEnabled && cardPresent)
                {
                  ITVCard unknownCard = _localCardCollection.Cards[cardNumber];

                  if (unknownCard is TvCardBase)
                  {
                    TvCardBase card = (TvCardBase)unknownCard;
                    if (card.PreloadCard)
                    {
                      try
                      {
                        Log.Info("Controller: preloading card :{0}", card.Name);
                        card.BuildGraph();
開發者ID:npcomplete111,項目名稱:MediaPortal-1,代碼行數:67,代碼來源:TVController.cs


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