public void ChangeDeveloper() { if (!_started) { throw new InvalidOperationException(); } AddCycleTime(); _soundPlayer.BeginPlayCycleSound(CycleTimes.Last()); _stopwatch.RestartAlarm(Session.CycleTime); if (_session.Get <bool>(Session.FinishHimTimeActive)) { _stopwatch.RestartAlarm(Session.FinishHimTime); } }
private void AddCycleTime() { var elapsed = _stopwatch.Elapsed; if (_lastStop == TimeSpan.Zero) { CycleTimes.Add(elapsed); } else { CycleTimes.Add(elapsed.Subtract(_lastStop)); } _lastStop = elapsed; AverageCycleTime = TimeSpan.FromMilliseconds(CycleTimes.Average(t => t.TotalMilliseconds)); }
private void CompileCycleTimes() { var currentCycleTime = _codingDojo.StartTime; var average = _session.Get <TimeSpan>(Session.CycleTime); CycleTimes.Clear(); Average.Clear(); foreach (var cycleTime in _codingDojo.CycleTimes) { var cycleTimeAsString = string.Format("{0}:{1:00}:{2:00}", currentCycleTime.Hour, currentCycleTime.Minute, currentCycleTime.Second); CycleTimes.Add(new KeyValuePair <string, double>(cycleTimeAsString, cycleTime.TotalMinutes)); currentCycleTime = currentCycleTime.Add(cycleTime); Average.Add(new KeyValuePair <string, double>(cycleTimeAsString, average.TotalMinutes)); } }