/// <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; }
/// <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; }