Esempio n. 1
0
        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);
            }
        }
Esempio n. 2
0
        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));
        }
Esempio n. 3
0
        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));
            }
        }