示例#1
0
        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();
        }
示例#2
0
        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();
        }