Exemple #1
0
        private void Subscribe()
        {
            if (m_selectedMeasurements.Count == 0)
            {
                Unsubscribe();
            }
            else
            {
                if (m_subscriber == null)
                {
                    InitializeSubscription();
                }
                else
                {
                    if (m_subscribedSynchronized && !string.IsNullOrEmpty(m_selectedSignalIDs))
                    {
                        m_subscriber.Unsubscribe();

                        if (m_historicalPlayback)
                        {
                            Dispatcher.BeginInvoke(new Action(delegate
                            {
                                string startTime       = TextBoxStartTime.Text;
                                string stopTime        = TextBoxStopTime.Text;
                                int processingInterval = int.Parse(TextBoxProcessInterval.Text);

                                if (DateTime.Compare(AdapterBase.ParseTimeTag(startTime),
                                                     AdapterBase.ParseTimeTag(stopTime)) < 0)
                                {
                                    ModeMessage.Text = "Initializing historical playback...";

                                    //m_synchronizedSubscriber.SynchronizedSubscribe(true, m_framesPerSecond, m_lagTime, m_leadTime, m_selectedSignalIDs, null, m_useLocalClockAsRealtime, m_ignoreBadTimestamps, startTime: TextBoxStartTime.Text, stopTime: TextBoxStopTime.Text, processingInterval: (int)SliderProcessInterval.Value);
                                    m_subscriber.UnsynchronizedSubscribe(true, false, m_selectedSignalIDs, null, true,
                                                                         m_lagTime, m_leadTime,
                                                                         m_useLocalClockAsRealtime, startTime, stopTime,
                                                                         null, processingInterval);
                                    m_waitingForData = true;
                                }
                                else
                                {
                                    MessageBox.Show("Start time must precede end time");
                                }
                            }));
                        }
                        else
                        {
                            //m_synchronizedSubscriber.SynchronizedSubscribe(true, m_framesPerSecond, m_lagTime, m_leadTime, m_selectedSignalIDs, null, m_useLocalClockAsRealtime, m_ignoreBadTimestamps);
                            m_subscriber.UnsynchronizedSubscribe(true, false, m_selectedSignalIDs, null, true, m_lagTime, m_leadTime, m_useLocalClockAsRealtime);
                        }
                    }

                    ChartPlotterDynamic.Dispatcher.BeginInvoke((Action)StartRefreshTimer);
                }
            }
        }
        /// <summary>
        /// Sets the boundaries for the x-axis.
        /// </summary>
        /// <param name="startTimeString">A string representation of the lower x-axis boundary.</param>
        /// <param name="endTimeString">A string representation of the upper x-axis boundary.</param>
        public void SetInterval(string startTimeString, string endTimeString)
        {
            DateTime startTime = AdapterBase.ParseTimeTag(startTimeString);
            DateTime endTime   = AdapterBase.ParseTimeTag(endTimeString);

            if (startTime > endTime)
            {
                throw new ArgumentException("startTime > endTime");
            }

            ClearHistory();
            m_xAxis.Minimum = null;
            m_xAxis.Maximum = null;
            m_yAxis.Minimum = null;
            m_yAxis.Maximum = null;

            m_xAxis.Minimum = startTime;
            m_xAxis.Maximum = endTime;
        }