/*-------------------------------------------------------------------------
* 功能描述:IdlingCommands
* 作者:xulisong
* 创建时间: 2019/1/3 17:22:01
* 版本号:v1.0
* -------------------------------------------------------------------------*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Autodesk.Revit.UI;
namespace FWindSoft.Revit
{
///
/// 空闲命令消费者队列
///
public class IdlingCommands
{
internal IdlingCommands()
{
Commands = new Queue();
}
#region 生产消费队列维护
///
/// 命令队列
///
private readonly Queue Commands;
///
/// 在队列中加入command
///
///
public void Enqueue(IdlingCommand command)
{
lock (Commands)
{
Commands.Enqueue(command);
}
}
///
/// 获取队列中的command
///
///
public IdlingCommand Dequeue()
{
IdlingCommand command = null;
lock (Commands)
{
if (HasCommand)
{
command = Commands.Dequeue(); ;
}
}
return command;
}
public bool HasCommand
{
get
{
return Commands.Count > 0;
}
}
#endregion
}
}