public void Dispose()
        {
            lock (this)
            {
                try
                {
                    if (timer1 != null)
                    {
                        timer1.Dispose();
                    }
                    if (_drivers != null)
                    {
                        foreach (var driver in Drivers)
                        {
                            driver.OnError -= this.reader_OnClose;
                            driver.Dispose();
                        }

                        if (tcpServer != null && tcpServer.Connected)
                        {
                            tcpServer.Disconnect(false);
                            tcpServer.Dispose();
                        }

                        _mapping.Clear();
                        reval.Dispose();
                    }
                }
                catch (Exception e)
                {
                    AddErrorLog(e);
                }
            }
        }
Exemple #2
0
 public void Dispose()
 {
     lock (this)
     {
         if (timer != null)
         {
             timer.Dispose();
         }
         group.SendResetRequest();
         reader.OnError -= this.reader_OnClose;
         reader.Dispose();
         if (_conditionList != null)
         {
             foreach (var condition in _conditionList)
             {
                 if (condition != null)
                 {
                     condition.AlarmActive -= cond_SendAlarm;
                 }
             }
         }
         reval.Dispose();
     }
 }