// Called from outside on any thread to enqueue work. public void RunAsMacroAsync(SendOrPostCallback d, object state) { lock (_sendOrPostLock) { _postCallbacks.Enqueue(d); _postStates.Enqueue(state); // CAREFUL: This check needs to be in the same lock used in SyncMacro when running if (!_isRunningMacros && !_syncPosted) { _syncWindow.PostRunSyncMacro(); _syncPosted = true; } } }
// Called from outside on any thread to enqueue work. public void RunAsMacroAsync(SendOrPostCallback d, object state) { if (!SynchronizationManager.IsInstalled) { throw new InvalidOperationException("SynchronizationManager is not registered. This is an unexpected error."); } lock (_sendOrPostLock) { _postCallbacks.Enqueue(d); _postStates.Enqueue(state); // CAREFUL: This check needs to be in the same lock used in SyncMacro when running if (!_isRunningMacros && !_syncPosted) { _syncWindow.PostRunSyncMacro(); _syncPosted = true; } } }
// Called from outside on any thread to enqueue work. public void RunAsMacroAsync(SendOrPostCallback d, object state) { if (!SynchronizationManager.IsInstalled) { throw new InvalidOperationException("SynchronizationManager is not registered. Call ExcelAsyncUtil.Initialize from an IExcelAddIn.AutoOpen implementation."); } lock (_sendOrPostLock) { _postCallbacks.Enqueue(d); _postStates.Enqueue(state); // CAREFUL: This check needs to be in the same lock used in SyncMacro when running if (!_isRunningMacros && !_syncPosted) { _syncWindow.PostRunSyncMacro(); _syncPosted = true; } } }