public void ClearEventInvocationList() { if (ErrorOccured != null) { foreach (var subscribedDelegate in ErrorOccured.GetInvocationList()) { ErrorOccured -= (EventHandler <BaseErrorResponseInfo>)subscribedDelegate; } } if (LoadingStarted != null) { foreach (var subscribedDelegate in LoadingStarted.GetInvocationList()) { LoadingStarted -= (EventHandler <EventArgs>)subscribedDelegate; } } if (LoadingCompleted != null) { foreach (var subscribedDelegate in LoadingCompleted.GetInvocationList()) { LoadingCompleted -= (EventHandler <EventArgs>)subscribedDelegate; } } }
protected void UnsubscribeEvents() { if (ErrorOccured != null) { foreach (var delegateMethod in ErrorOccured.GetInvocationList()) { ErrorOccured -= (delegateMethod as ErrorEventHandler); } } }
public void UnsubscribeAllHandlers() { if (ErrorOccured != null) { foreach (var handler in ErrorOccured.GetInvocationList()) { ErrorOccured -= handler as Action <ChatType, string, string>; } } if (MessageReceived != null) { foreach (var handler in MessageReceived.GetInvocationList()) { MessageReceived -= handler as Action <ChatType, string, string>; } } }