At.FF.Krems.FullscreenBrowser.QueueManager.ExecuteAction C# (CSharp) Method

ExecuteAction() public method

Executes an action in the worker thread. If you call this method not on worker thread, no action will be executed.
public ExecuteAction ( System.Action action, bool executeIfCalledOnWorkerThread = false ) : void
action System.Action The action. Use it like delegate{...}.
executeIfCalledOnWorkerThread bool If method gets called on worker thread and this flag is set to true, action will be called direct on worker thread. /// If false no execution! Default is false.
return void
        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);
        }