public virtual void Start()
 {
     ReplayTimer.Start();
 }
Esempio n. 2
0
        private void AsyncThread_DoWork(object sender)
        {
            ReplayTimer Time = new ReplayTimer();

            float statusPrevTime       = 0;
            float rangePrevTime        = 0;
            RangeDeviceEventArgs rPrev = null;
            StatusEventArgs      sPrev = null;

            Time.Reset();
            Time.Start();

            StatusDataReceived?.Invoke(new object(), StartingStatusEventArgs);
            foreach (RangeDeviceEventArgs e in StartingRangeDeviceCurrentReadings)
            {
                RangeDeviceCurrentDataReceived?.Invoke(new object(), e);
            }

            while (IsRunning)
            {
                if (IsPaused)
                {
                    Time.Stop();
                    Thread.Sleep(UpdateRate);
                    continue;
                }
                Time.Start();
                Time.Tick();


                foreach (RangeDeviceEventArgs r in ReplayLaserEntries)
                {
                    if (r.Timestamp >= Time.TotalTime)
                    {
                        if (r.Timestamp == rangePrevTime)
                        {
                            break;
                        }
                        rangePrevTime = r.Timestamp;

                        if (rPrev == null)
                        {
                            rPrev = r;
                        }

                        RangeDeviceCurrentDataReceived?.Invoke(new object(), rPrev);

                        rPrev = r;

                        break;
                    }
                }

                foreach (StatusEventArgs r in ReplayStatusEntries)
                {
                    if (r.Timestamp >= Time.TotalTime)
                    {
                        if (r.Timestamp == statusPrevTime)
                        {
                            break;
                        }
                        statusPrevTime = r.Timestamp;

                        if (sPrev == null)
                        {
                            sPrev = r;
                        }

                        StatusDataReceived?.Invoke(new object(), sPrev);

                        sPrev = r;

                        break;
                    }
                }

                Thread.Sleep(UpdateRate);

                //Robot.Write("onelinestatus");
                //foreach (string l in Devices)
                //{
                //    Robot.Write("rangeDeviceGetCurrent " + l);
                //}
                //foreach (string l in Devices)
                //{
                //    Robot.Write("rangeDeviceGetCumulative " + l);
                //}
            }
        }