예제 #1
0
        /// <summary>
        /// Broadcast a plot event to anyone who's listening
        /// </summary>
        /// <param name="samples"></param>
        private void BroadcastPlot(SamplePlot samples)
        {
            EventHandler<PlotEventArgs> handler = OnPlot;

            if (handler != null)
                handler(this, new PlotEventArgs(samples));
        }
        /// <summary>
        /// Plot an array of samples.
        /// </summary>
        /// <param name="Samples">The array of samples to plot</param>
        public void Plot(SamplePlot Samples)
        {
            int i = 0;
            int sampleTicks = 0;

            Signals = new List<SampleSignal>[Samples.SampleSignals.Length];

            foreach (List<SampleSignal> sampleList in Samples.SampleSignals)
            {
                if (i == 0)
                {
                    // Find the duration of the first sample (they are all equal).
                    foreach (SampleSignal ss in sampleList)
                        sampleTicks += ss.Duration;

                    totalSampleTicks = sampleTicks;
                }
                Signals[i++] = sampleList;
            }

            // Set the scrollbar.
            // NOTE: This could overflow if the ticks are too large.
            hScrollBar1.Maximum = totalSampleTicks;
            hScrollBar1.Value = 0;
            Invalidate();
        }
 /// <summary>
 /// Creates and initializes a PlotEventArgs object.
 /// </summary>
 /// <param name="Samples">A SamplePlot object representing several arrays of samples</param>
 public PlotEventArgs(SamplePlot Samples)
 {
     this.Samples = Samples;
 }