예제 #1
0
        private void tickTimer(object sender, ElapsedEventArgs e)
        {
            if (DEBUG_PROFILER_LIMIT > 0)
            {
                if (fIterationsCounter >= DEBUG_PROFILER_LIMIT)
                {
                    return;
                }
                else
                {
                    fIterationsCounter++;
                }
            }

            if (this.fBusy)
            {
                return;
            }
            this.fBusy = true;
            try
            {
                this.updatePhysics();
                this.updateViewBounds();

                if (fRenderer != null)
                {
                    fRenderer.Invalidate();
                }

                if (this.fAutoStop)
                {
                    if (EnergyMean <= this.fStopThreshold)
                    {
                        if (fPrevTime == DateTime.FromBinary(0))
                        {
                            fPrevTime = DateTime.Now;
                        }
                        TimeSpan ts = DateTime.Now - fPrevTime;
                        if (ts.TotalMilliseconds > 1000)
                        {
                            this.stop();
                        }
                    }
                    else
                    {
                        fPrevTime = DateTime.FromBinary(0);
                    }
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine("ArborSystem.tickTimer(): " + ex.Message);
            }
            this.fBusy = false;
        }
예제 #2
0
        protected void TickTimer()
        {
            if (fBusy)
            {
                return;
            }
            fBusy = true;

            try {
                UpdatePhysics();
                UpdateViewBounds();

                if (fRenderer != null)
                {
                    fRenderer.Invalidate();
                }

                if (fAutoStop)
                {
                    if (fEnergyMean <= fStopThreshold)
                    {
                        if (fPrevTime == DateTime.FromBinary(0))
                        {
                            fPrevTime = DateTime.Now;
                        }
                        TimeSpan ts = DateTime.Now - fPrevTime;
                        if (ts.TotalMilliseconds > 1000.0f)
                        {
                            Stop();
                        }
                    }
                    else
                    {
                        fPrevTime = DateTime.FromBinary(0);
                    }
                }
            } catch (Exception ex) {
                Debug.WriteLine("ArborSystem.TickTimer(): " + ex.Message);
            }

            fBusy = false;
        }