/// <summary>Invokes on the invokable thread.</summary> /// <param name="actionName">For debugging purposes.</param> /// <param name="action">The action to invoke.</param> private void Invoke(string actionName, Action action) { if (0 == _invokeCount) // no reentrancy { _previousActionName = actionName; ++_invokeCount; ComDebug.ReportInfo("OleAdviseThread {0}", actionName); _invokeableThread.Invoke(action); --_invokeCount; } else // Invoke was called before and is has not finished up to now { ComDebug.ReportWarning("ManagedOleAdviseHolder.Invoke: because a previous action ({0}) is still running, the action ({1}) is invoked asynchronously now.", _previousActionName, actionName); _invokeableThread.InvokeAsync(action); } }
/// <summary>Makes invocation of Invoke more concise with parameter- /// less methods.</summary> protected void Invoke(string actionName, Action invoker) { ComDebug.ReportInfo("DataAdviseThread {0}", actionName); _dataAdviseThread.Invoke(invoker); }