Esempio n. 1
0
 public void AddACKCheckEvent(ACKDelegate check_delegate,
                              int timeOut       = -1,
                              string timeOutMsg = "",
                              TimeOutDelegate timeout_delegate = null)
 {
     if (timeOut > 0)
     {
         System.Threading.Timer timer = new System.Threading.Timer(
             delegate(object state)
         {
             if (timeOutEvent != null)
             {
                 timeOutEvent.Invoke();
             }
             RemoveACKCheckEvent();
             //mainForm.ShowMessageBox(timeOutMsg);
         }, null, timeOut, System.Threading.Timeout.Infinite);
         ackCheckEvent += delegate() { timer.Dispose(); };
     }
     ackCheckEvent += check_delegate;
     timeOutEvent  += timeout_delegate;
 }
Esempio n. 2
0
 public void RemoveACKCheckEvent()
 {
     ackCheckEvent = null;
     timeOutEvent  = null;
 }