Exemple #1
0
        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)));
            }
        }
Exemple #2
0
        /// <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();
        }
Exemple #3
0
        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)));
            }
        }
Exemple #4
0
 /// <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;
     }
 }