BOLTStack.Application.InvokeActions C# (CSharp) Method

InvokeActions() private method

private InvokeActions ( ) : void
return void
        private void InvokeActions()
        {
            if (_invokeActions == null) return;
            if (Monitor.TryEnter(_invokeActions))
            {
                try
                {
                    if (_invokeActions.Count == 0)
                    {
                        return;
                    }

                    Action action = null;
                    if (_invokeActions.Count > 0)
                    {
                        action = _invokeActions.Dequeue();
                    }
                    while (action != null)
                    {
                        Monitor.Exit(_invokeActions);
                        try
                        {
                            action();
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.Message);
                        }
                        Monitor.Enter(_invokeActions);
                        action = _invokeActions.Count > 0 ? _invokeActions.Dequeue() : null;
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }
                finally
                {
                    Monitor.Exit(_invokeActions);
                }
            }
        }