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


C# Options.GetInt方法代码示例

本文整理汇总了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;
        }
开发者ID:ChrisBrandhorst,项目名称:Touchee_HTTPServer,代码行数:48,代码来源:Library.cs


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