static Simulator() { Notifier = new Notifier(); Interval = new TimeSpan(0, 7, 17); Clock = new Clock(Interval); ParkingFacility = new ParkingFacility(); }
public void Run() { _cancellationToken = _cancellationSource.Token; _task = Task.Run(async() => { while (!_cancellationToken.IsCancellationRequested) { Clock.Tick(); Generator.Tick(); ParkingFacility.Tick(); await Task.Delay(_frequency, _cancellationToken); } }, _cancellationToken); }