using System; using System.Collections.Generic; using System.Diagnostics; using Autodesk.Revit.UI; 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 IList Queue { get; set; } public ExternalEventHandler(IList 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"; } } }