private static void SWIG_CompletionDispatcher(int key) { FutureString.Action action = null; object callbackLock = FutureString.CallbackLock; lock (callbackLock) { if (FutureString.Callbacks != null && FutureString.Callbacks.TryGetValue(key, out action)) { FutureString.Callbacks.Remove(key); } } if (action != null) { action(); } }
public void SetOnCompletionCallback(FutureString.Action userCompletionCallback) { if (this.SWIG_CompletionCB == null) { this.SWIG_CompletionCB = new FutureString.SWIG_CompletionDelegate(FutureString.SWIG_CompletionDispatcher); } object callbackLock = FutureString.CallbackLock; int num; lock (callbackLock) { if (FutureString.Callbacks == null) { FutureString.Callbacks = new Dictionary <int, FutureString.Action>(); } num = ++FutureString.CallbackIndex; FutureString.Callbacks[num] = userCompletionCallback; } this.SetCompletionData(this.SWIG_OnCompletion(this.SWIG_CompletionCB, num)); }