/// <summary> /// Releases the unmanaged resources used by the <see cref="AlarmMonitor"/> object and optionally releases the managed resources. /// </summary> /// <param name="disposing">true to release both managed and unmanaged resources; false to release only unmanaged resources.</param> protected virtual void Dispose(bool disposing) { if (!m_disposed) { try { if (disposing) { if ((object)m_refreshTimer != null) { m_refreshTimer.Dispose(); m_refreshTimer = null; } if ((object)m_alarmStatusQuery != null) { m_alarmStatusQuery.RaisedAlarmStates -= m_alarmStatusQuery_RaisedAlarmStates; m_alarmStatusQuery.ProcessException -= m_alarmStatusQuery_ProcessException; m_alarmStatusQuery.Dispose(); m_alarmStatusQuery = null; } if ((object)m_dataSubscriber != null) { m_dataSubscriber.ConnectionEstablished -= m_dataSubscriber_ConnectionEstablished; m_dataSubscriber.ReceivedServerResponse -= m_dataSubscriber_ReceivedServerResponse; m_dataSubscriber.NewMeasurements -= m_dataSubscriber_NewMeasurements; m_dataSubscriber.ProcessException -= m_dataSubscriber_ProcessException; m_dataSubscriber.Dispose(); m_dataSubscriber = null; } } } finally { m_disposed = true; // Prevent duplicate dispose. } } }