Beispiel #1
0
        private void SafeInvokeDisconnected()
        {
            if (Disconnected == null)
            {
                return;         //No Listeners
            }
            DisconnectedEvent listener = null;

            Delegate[] dels = Disconnected.GetInvocationList();

            foreach (Delegate del in dels)
            {
                try
                {
                    listener = (DisconnectedEvent)del;
                    listener.Invoke();
                }
                catch (Exception)
                {
                    //Could not reach the destination, so remove it
                    //from the list
                    Disconnected -= listener;
                }
            }
        }
Beispiel #2
0
 internal async Task <bool> CheckDisconnected()
 {
     if (!await CheckAlive())
     {
         foreach (AsyncEventHandler d in Disconnected.GetInvocationList())
         {
             await d(this, EventArgs.Empty);
         }
         return(true);
     }
     return(false);
 }
 private void CallDisconnected()
 {
     if (Disconnected != null)
     {
         foreach (var d in Disconnected.GetInvocationList())
         {
             try
             {
                 (d as DisconnectedEventHandler)(this);
             }
             catch { }
         }
     }
 }