private static void RaiseCompleted(IntPtr cPtr, IntPtr sender, IntPtr e) { try { if (Noesis.Extend.Initialized) { long ptr = cPtr.ToInt64(); if (sender == IntPtr.Zero && e == IntPtr.Zero) { _Completed.Remove(ptr); return; } CompletedHandler handler = null; if (!_Completed.TryGetValue(ptr, out handler)) { throw new InvalidOperationException("Delegate not registered for Completed event"); } handler?.Invoke(Noesis.Extend.GetProxy(sender, false), new EventArgs(e, false)); } } catch (Exception exception) { Noesis.Error.UnhandledException(exception); } }
protected virtual void OnComplete() { CompletedHandler?.Invoke(this); }