public void UnsubscribeASAPEvent(string uniqueId) { executionCallback h = null; if (asapHandlers.ContainsKey(uniqueId)) { asapHandlers.Remove(uniqueId, out h); } }
private void invokeAll() { executionCallback h = null; foreach (KeyValuePair <string, executionCallback> handler in asapHandlers) { asapHandlers.Remove(handler.Key, out h); handler.Value.Invoke(); } }
public void RebuildModules(executionCallback onSuccess = null) { pm.invokeASAP("ModuleManager.RebuildModules", () => { _RebuildModules(); if (onSuccess != null) { onSuccess(); } }); }
/** * Executes the specified function when the instance is free. If it's already free executes in moment */ public void invokeASAP(string uniqueId, executionCallback handler) { executionCallback h = null; if (asapHandlers.ContainsKey(uniqueId)) { asapHandlers.Remove(uniqueId, out h); } asapHandlers.AddOrUpdate(uniqueId, handler, (k, v) => { return(v); }); if (!_isBusy) { invokeAll(); } }