/// <summary> /// Creates a new local concentrator. /// </summary> public LocalConcentrator(DataSubscriber parent) { m_parent = parent; }
/// <summary> /// Releases the unmanaged resources used by the <see cref="LocalConcentrator"/> 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 override void Dispose(bool disposing) { if (!m_disposed) { try { if (disposing) m_parent = null; } finally { m_disposed = true; // Prevent duplicate dispose. base.Dispose(disposing); // Call base class Dispose(). } } }
void UnsubscribeData() { try { if (m_dataSubscriber != null) { m_dataSubscriber.Unsubscribe(); StopSubscription(); } } catch { m_dataSubscriber = null; } }
void StopSubscription() { if (m_dataSubscriber != null) { m_dataSubscriber.StatusMessage -= dataSubscriber_StatusMessage; m_dataSubscriber.ProcessException -= dataSubscriber_ProcessException; m_dataSubscriber.ConnectionEstablished -= dataSubscriber_ConnectionEstablished; m_dataSubscriber.NewMeasurements -= dataSubscriber_NewMeasurements; m_dataSubscriber.Stop(); m_dataSubscriber.Dispose(); m_dataSubscriber = null; } }
void StartSubscription() { string server = openPDCManager.Utilities.Common.GetDataPublisherServer(); string port = openPDCManager.Utilities.Common.GetDataPublisherPort(); m_dataSubscriber = new DataSubscriber(); m_dataSubscriber.StatusMessage += dataSubscriber_StatusMessage; m_dataSubscriber.ProcessException += dataSubscriber_ProcessException; m_dataSubscriber.ConnectionEstablished += dataSubscriber_ConnectionEstablished; m_dataSubscriber.NewMeasurements += dataSubscriber_NewMeasurements; m_dataSubscriber.ConnectionTerminated += dataSubscriber_ConnectionTerminated; m_dataSubscriber.ConnectionString = "server=" + server + ":" + port; m_dataSubscriber.Initialize(); m_dataSubscriber.Start(); }
void UnsubscribeDataForChart() { try { if (m_chartSubscriber != null) { //System.Diagnostics.Debug.WriteLine("SUBSCRIPTION: Un-Subscribing Data."); m_chartSubscriber.Unsubscribe(); StopSubscriptionForChart(); } } catch { m_chartSubscriber = null; } StopChartRefreshTimer(); }
void UnsubscribeDataForTree() { try { if (m_measurementDataSubscriber != null) { m_measurementDataSubscriber.Unsubscribe(); StopSubscriptionForTree(); } } catch { m_measurementDataSubscriber = null; } }