public void ExecuteAction(Action action, bool executeIfCalledOnWorkerThread = false)
{
if (action == null)
{
Logger.Warn("Action is NULL");
return;
}
if (Thread.CurrentThread == this.actionWorkerThread)
{
if (executeIfCalledOnWorkerThread)
{
Logger.TraceFormat("ExecuteAction({0}, true) -> ExecuteIfCalledOnWorkerThread is true => execute action direct on thread \"{1}\"!", action.Method, Thread.CurrentThread.Name);
action();
return;
}
Logger.TraceFormat("ExecuteAction({0}, false) -> ExecuteIfCalledOnWorkerThread is false => no execution of action on thread \"{1}\"!", action.Method, Thread.CurrentThread.Name);
}
Logger.TraceFormat("Adding action({0}) to action queue", action.Method);
this.actionQueue.Add(action);
}