public QueueManager()
{
Logger.DebugFormat("Initialize {0}()", MethodBase.GetCurrentMethod().Name);
this.actionWorkerThread = new Thread(
() =>
{
foreach (var action in this.actionQueue.GetConsumingEnumerable())
{
try
{
Logger.DebugFormat("Executing action \"{0}\" on \"{1}\"", action.Method, action.Target);
action();
}
catch (Exception exception)
{
Logger.Error("Exception occured in action\"" + action.Method + "\" on \"" + action.Target + "\"", exception);
}
}
}) { Name = "Action Worker Thread", IsBackground = true };
this.actionWorkerThread.SetApartmentState(ApartmentState.STA);
Logger.Debug("Start actionWorkerThread");
this.actionWorkerThread.Start();
}