public void ExecuteAddNewSleepTimeCommand(object parametr) { NewSleep.Time = DateTime.Now; DaySleepTime.Add(new OneSleep() { Duration = NewSleep.Duration, Time = NewSleep.Time }); TotalSleepTime = TotalSleepTime.Add(TimeSpan.FromSeconds(NewSleep.GetDurationInSecond())); SleepRepository.Instance.AddOperation(NewSleep); OnPropertyChanged("TotalSleepTime"); CommandManager.InvalidateRequerySuggested(); NewSleep = new OneSleep(); CheckTotalSleepTime(); }
public void ExecuteDellCurrentSleepTimeCommand(object parametr) { NewSleep.Time = DateTime.Now; TotalSleepTime = TotalSleepTime.Subtract(TimeSpan.FromSeconds(CurrentSleep.GetDurationInSecond())); SleepRepository.Instance.DeleteOperation(CurrentSleep); DaySleepTime.Remove(CurrentSleep); OnPropertyChanged("TotalSleepTime"); CommandManager.InvalidateRequerySuggested(); if (DaySleepTime.Count > 0) { CurrentSleep = DaySleepTime.First(); } CheckTotalSleepTime(); }