예제 #1
0
        private void Tick(object source, ElapsedEventArgs e)
        {
            lock (TIPLock)
            {
                if (!TickInProgress)
                {
                    TickInProgress = true;
                }
                else
                {
                    return;
                }
            }
            //Log("Tick Start");
            tick++;
            //Log("The Elapsed event was raised at " + e.SignalTime.Hour + "." + e.SignalTime.Minute + "." + e.SignalTime.Second + "." + e.SignalTime.Millisecond);
            //Log("Tick " + tick + " Started at " + DateTime.Now.Minute + "." + DateTime.Now.Second + "." + DateTime.Now.Millisecond );
            try
            {
                network.Tick(tick);
            }
            catch (Exception ex)
            {
                Log(ex.ToString());
            }
            finally
            {
                if (tick % 10 == 0)
                {
                    Log("tick " + tick);
                }

                lock (TIPLock)
                {
                    TickInProgress = false;
                }
            }
            //Log("Tick " + tick + " Ended at " + DateTime.Now.Minute + "." + DateTime.Now.Second + "." + DateTime.Now.Millisecond);

            //Log("Tick fin");
        }