public void SubscribeUnsynchronizedData(bool historical) { UnsynchronizedSubscriptionInfo info; if (m_unsynchronizedSubscriber == null) { InitializeUnsynchronizedSubscription(); } if (m_subscribedUnsynchronized && !string.IsNullOrEmpty(m_allSignalIDs)) { info = new UnsynchronizedSubscriptionInfo(true); info.UseCompactMeasurementFormat = true; info.FilterExpression = m_allSignalIDs; info.IncludeTime = true; info.LagTime = 60.0D; info.LeadTime = 60.0D; info.PublishInterval = m_refreshInterval; if (historical) { info.StartTime = StartTime; info.StopTime = StopTime; info.ProcessingInterval = m_refreshInterval * 1000; } m_unsynchronizedSubscriber.Subscribe(info); } if (m_statistics == null) { Application.Current.Dispatcher.BeginInvoke(new Action(() => Statistics = new RealTimeStatistics(1, m_statisticRefreshInterval))); } }
/// <summary> /// Creates an instance of <see cref="RealTimeStreams"/>. /// </summary> /// <param name="itemsPerPage"></param> /// <param name="refreshInterval">Interval to refresh measurement in a tree.</param> /// <param name="autoSave"></param> public RealTimeStreams(int itemsPerPage, int refreshInterval, bool autoSave = false) : base(itemsPerPage, autoSave) { // Perform initialization here. m_refreshInterval = refreshInterval; InitializeUnsynchronizedSubscription(); m_restartConnectionCycle = true; StatisticMeasurements = new ObservableCollection <StatisticMeasurement>(); int.TryParse(IsolatedStorageManager.ReadFromIsolatedStorage("StatisticsDataRefreshInterval").ToString(), out m_statisticRefreshInterval); Statistics = new RealTimeStatistics(1, m_statisticRefreshInterval); CheckTemporalSupport(); }
public void SubscribeUnsynchronizedData(bool historical) { UnsynchronizedSubscriptionInfo info; if (m_unsynchronizedSubscriber == null) { InitializeUnsynchronizedSubscription(); } if (m_subscribedUnsynchronized && !string.IsNullOrEmpty(m_allSignalIDs)) { double lagTime; double leadTime; if (!double.TryParse(IsolatedStorageManager.ReadFromIsolatedStorage("LagTime")?.ToString(), out lagTime)) { lagTime = 60.0D; } if (!double.TryParse(IsolatedStorageManager.ReadFromIsolatedStorage("LeadTime")?.ToString(), out leadTime)) { leadTime = 60.0D; } info = new UnsynchronizedSubscriptionInfo(true); info.UseCompactMeasurementFormat = true; info.FilterExpression = m_allSignalIDs; info.IncludeTime = true; info.UseLocalClockAsRealTime = IsolatedStorageManager.ReadFromIsolatedStorage("UseLocalClockAsRealTime").ToNonNullString("true").ParseBoolean(); info.LagTime = lagTime; info.LeadTime = leadTime; info.PublishInterval = m_refreshInterval; if (historical) { info.StartTime = StartTime; info.StopTime = StopTime; info.ProcessingInterval = m_refreshInterval * 1000; } m_unsynchronizedSubscriber.Subscribe(info); } if (m_statistics == null) { Application.Current.Dispatcher.BeginInvoke(new Action(() => Statistics = new RealTimeStatistics(1, m_statisticRefreshInterval))); } }
/// <summary> /// Unsubscribes data from the service. /// </summary> public void UnsubscribeUnsynchronizedData() { try { if (m_unsynchronizedSubscriber != null) { m_unsynchronizedSubscriber.Unsubscribe(); StopUnsynchronizedSubscription(); if (m_statistics != null) { m_statistics.Stop(); Statistics = null; } } } catch { m_unsynchronizedSubscriber = null; } }