Пример #1
0
        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;
                        }
                    }
                }
            }
        }
Пример #2
0
 public void OnAccessRequested(object sender, CoreAccessRequestedEventArgs e)
 {
     // forward the message to the client
     if (AccessRequested != null)
     {
         AccessRequested(this, e);
     }
 }