Exemple #1
0
        public void BreakFinished()
        {
            var currentTime    = System.DateTime.Now;
            var soFarLeft      = 3600 - currentTime.Minute * 60 - currentTime.Second;
            var hourDifference = currentTime.Hour - currentHour.Hour;

            if (hourDifference == 0)
            {
                int breakDuration = hourTicksLeft - soFarLeft;
                currentHour.Break += breakDuration;
            }
            else
            {
                currentHour.Break += hourTicksLeft;
                hours.Add(currentHour);
                for (int i = 1; i < hourDifference; ++i)
                {
                    hours.Add(new HourModel(currentHour.Hour + i)
                    {
                        Break = 3600
                    });
                }
                currentHour = new HourModel(currentHour.Hour + hourDifference)
                {
                    Break = 3600 - soFarLeft
                };
            }
            hourTicksLeft = soFarLeft;
        }
Exemple #2
0
 private void HandleHour()
 {
     if (--hourTicksLeft <= 0)
     {
         hours.Add(currentHour);
         currentHour = new HourModel(hours.Last().Hour + 1);
     }
 }
Exemple #3
0
        private void BeginCounting()
        {
            var currentTime = System.DateTime.Now;

            hourTicksLeft     = 3600 - currentTime.Minute * 60 - currentTime.Second;
            currentHour       = new HourModel(currentTime.Hour);
            currentHour.Break = 3600 - hourTicksLeft;
        }