本文整理汇总了C#中Options.GetInt方法的典型用法代码示例。如果您正苦于以下问题:C# Options.GetInt方法的具体用法?C# Options.GetInt怎么用?C# Options.GetInt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Options
的用法示例。
在下文中一共展示了Options.GetInt方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Play
/// <summary>
/// Start playing a set of items
/// </summary>
/// <param name="container">The container in which the items reside</param>
/// <param name="filter">Filter used to get the items from the container</param>
public Queue Play(Container container, Options filter)
{
// Get the plugin for the container
var contentsPlugin = Plugins.GetContentsPluginFor(container);
if (contentsPlugin == null) return null;
// Get the items for this container / filter combination
var items = contentsPlugin.GetItems(container, filter);
// Bail out if no items
if (items.Count() == 0) return null;
// Build queue and queue info object
var queue = new Queue(items, container.ContentType);
// Find existing queue of same type
var existingQueue = Queue.FirstOrDefault(q => q.ContentType == queue.ContentType);
// If we have a similar queue, move repeat and shuffle settings
if (existingQueue != null) {
queue.Repeat = existingQueue.Repeat;
queue.Shuffle = existingQueue.Shuffle;
}
// Set callbacks on queue
queue.IndexChanged += queue_IndexChanged;
queue.ItemsUpdated += queue_ItemsUpdated;
queue.Finished += queue_Finished;
// Save the queue
queue.Save();
// Set index, starting the queue
var id = filter.GetInt("id");
if (id > 0) {
var item = items.FirstOrDefault(i => i.ID == id);
queue.Current = item;
}
else
queue.Index = filter.GetInt("index");
return queue;
}