public void OnAccessRequested(CoreAccessRequestedEventArgs e) { if (AccessRequested == null) { return; } var InvocationList = AccessRequested.GetInvocationList(); lock (this) { foreach (AccessRequestedEventHandler DelegateToInvoke in InvocationList) { try { DelegateToInvoke.Invoke(this, e); } catch (Exception ex) { if (ex.GetType() == typeof(SocketException) || ex.GetType() == typeof(RemotingException)) { AccessRequested -= DelegateToInvoke; } else { throw; } } } } }
public void OnAccessRequested(object sender, CoreAccessRequestedEventArgs e) { // forward the message to the client if (AccessRequested != null) { AccessRequested(this, e); } }