コード例 #1
0
        /// <summary>
        /// Stop sensors interrogating & health tracking.
        /// </summary>
        public void Stop()
        {
            if (StateTimer == null)
            {
                Console.WriteLine("\nFitness tracker is not started yet!");
                return;
            }
            StateTimer.Change(Timeout.Infinite, Timeout.Infinite);

            Console.WriteLine("\nFitness tracker is stopped!");
            _isActive = false;
        }
コード例 #2
0
 /// <summary>
 /// Start sensors interrogating & health tracking.
 /// </summary>
 public void Run()
 {
     if (StateTimer == null)
     {
         StateTimer = new Timer(Sensors.CheckStatus,
                                state: null,
                                dueTime: CheckInteval,
                                period: CheckInteval);
     }
     else
     {
         StateTimer.Change(dueTime: CheckInteval,
                           period: CheckInteval);
     }
     _isActive = true;
 }