示例#1
0
 private void RemoveAllEventHandels()
 {
     lock (this)
     {
         if (NewClientConnected != null)
         {
             var del = NewClientConnected.GetInvocationList();
             for (int i = 0; i < del.Length; i++)
             {
                 NewClientConnected -= del[i] as Action <IRemoteXTMF>;
             }
         }
         if (NewClientConnected != null)
         {
             var del = NewClientConnected.GetInvocationList();
             for (int i = 0; i < del.Length; i++)
             {
                 NewClientConnected -= del[i] as Action <IRemoteXTMF>;
             }
         }
         if (ClientDisconnected != null)
         {
             var del = ClientDisconnected.GetInvocationList();
             for (int i = 0; i < del.Length; i++)
             {
                 ClientDisconnected -= del[i] as Action <IRemoteXTMF>;
             }
         }
         if (ProgressUpdated != null)
         {
             var del = ProgressUpdated.GetInvocationList();
             for (int i = 0; i < del.Length; i++)
             {
                 ProgressUpdated -= del[i] as Action <IRemoteXTMF, float>;
             }
         }
         if (ClientRunComplete != null)
         {
             var del = ClientRunComplete.GetInvocationList();
             for (int i = 0; i < del.Length; i++)
             {
                 ClientRunComplete -= del[i] as Action <IRemoteXTMF, int, string>;
             }
         }
         if (AllModelSystemRunsComplete != null)
         {
             var del = AllModelSystemRunsComplete.GetInvocationList();
             for (int i = 0; i < del.Length; i++)
             {
                 AllModelSystemRunsComplete -= del[i] as Action;
             }
         }
         RemoveAll(_CustomHandlers);
         RemoveAll(_CustomReceivers);
         RemoveAll(_CustomSenders);
     }
 }