using Autodesk.Revit.UI;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace xUnitRevit
{
///
/// Event invoker. Has a queue of actions that, in theory, this thing should iterate through.
/// Required to run transactions form a non modal window.
///
public class ExternalEventHandler : IExternalEventHandler
{
public bool Running = false;
public List Queue { get; set; }
public ExternalEventHandler(List queue)
{
Queue = queue;
}
public void Execute(UIApplication app)
{
Debug.WriteLine("Current queue len is: " + Queue.Count);
if (Running) return; // queue will run itself through
Running = true;
Queue[0]();
Queue.RemoveAt(0);
Running = false;
}
public string GetName()
{
return "xUnit Revit";
}
}
}