本文整理汇总了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();
}
示例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();