Exemplo n.º 1
0
 public ViewModel(NotifyIconHandler notifyIconHandler, ScheduleService scheduleService)
 {
     State            = States.Started;
     _notifyIcon      = notifyIconHandler;
     _scheduleService = scheduleService;
     _model           = scheduleService.GetEmptyDaySchedule();
     ConfigureTimer();
     ConfigureNotifyIcon();
 }
Exemplo n.º 2
0
        public void EndPause(DayScheduleModel model)
        {
            var pause = model.Pauses.FirstOrDefault(p => !p.StopTime.HasValue);

            if (pause != null)
            {
                pause.StopTime = DateTime.Now.CutSecond();
            }
            UpdatePredictStopTime(model);
        }
Exemplo n.º 3
0
        public void AddPause(DayScheduleModel model, string comment = null)
        {
            var pause = new PauseModel
            {
                StartTime = DateTime.Now.CutSecond(),
                Comment   = comment
            };

            model.Pauses.Add(pause);
        }
Exemplo n.º 4
0
        public DayScheduleModel GetEmptyDaySchedule()
        {
            var model = new DayScheduleModel {
                StartTime = DateTime.Now.CutSecond()
            };

            model.PredictStopTime = model.StartTime.Add(_eightHours);
            model.Pauses          = new List <PauseModel>();
            return(model);
        }
Exemplo n.º 5
0
 public void UpdateSpentTime(DayScheduleModel model)
 {
     model.SpentTime = (DateTime.Now.CutSecond() - model.StartTime) - SumPausesTime(model.Pauses);
     model.OverTime  = model.SpentTime > _eightHours ? model.SpentTime - _eightHours : (TimeSpan?)null;
 }
Exemplo n.º 6
0
 public void UpdatePredictStopTime(DayScheduleModel model)
 {
     model.PredictStopTime = model.StartTime.Add(_eightHours) + SumPausesTime(model.Pauses);
 }