Exemplo n.º 1
0
        public void SaveAimTimer(IAimTimerItem aimTimerItem)
        {
            var now = _dateTimeProvider.GetNow();

            var status = aimTimerItem.GetStatus();

            var aimTimerModel     = aimTimerItem.AimTimer.GetAimTimerModel();
            var aimTimerItemModel = aimTimerItem.GetAimTimerItemModel();

            aimTimerItemModel.AimTimerId = aimTimerModel.Id;
            aimTimerItemModel.IsFinished = status.IsFinished;
            aimTimerItemModel.Index      = aimTimerItem.AimTimer.GetIndexByDate(aimTimerItem.StartOfActivityPeriod);

            _repository.Save(aimTimerModel, aimTimerModel.Id);
            _repository.Save(aimTimerItemModel, aimTimerItemModel.Id);

            var itemsToUpdate = _repository
                                .LoadAllByKey <AimTimerItemModel>("aimTimerId", aimTimerModel.Id)
                                .Where(i => i.StartOfActivityPeriod > now)
                                .OrderBy(i => i.StartOfActivityPeriod)
                                .ToList();

            var inARow = aimTimerItemModel.IsFinished ? aimTimerItemModel.PreviousInARow + 1 : 0;

            foreach (var i in itemsToUpdate)
            {
                i.PreviousInARow = inARow;
                inARow           = i.IsFinished ? i.PreviousInARow + 1 : 0;
                _repository.Save(i, i.Id);
            }
        }
        public IAimTimerViewModel Create(IAimTimerItem aimTimerItem)
        {
            var result = new AimTimerViewModel(
                _navigation,
                _messagingCenter,
                _aimTimerService);

            result.Setup(aimTimerItem);
            return(result);
        }
Exemplo n.º 3
0
        private void OnItemUpdated(IAimTimerItem aimTimerItem)
        {
            var result = AimTimerListItemViewModels.FirstOrDefault(i => i.GetAimTimerItem() == aimTimerItem);

            if (result == null)
            {
                //_aimTimerNotificationService.Stop();
                result = _aimTimerItemViewModelFactory.Create(aimTimerItem);
                AimTimerListItemViewModels.Add(result);
                //_aimTimerNotificationService.Start();
            }
            result.Refresh();
        }
        public IAimTimerListItemViewModel Create(IAimTimerItem aimTimerItem)
        {
            var result = new AimTimerListItemViewModel(
                _dateTimeProvider,
                _alertManager,
                _navigation,
                _messagingCenter,
                _aimTimerService,
                _viewFactory,
                _aimTimerIntervalListItemViewModelFactory,
                _aimTimerIntervalFactory,
                _aimTimerIntervalViewModelFactory);

            result.Setup(aimTimerItem);
            return(result);
        }
Exemplo n.º 5
0
 private async Task NavigateAimTimerView(IAimTimerItem aimTimerItem)
 {
     var aimTimerViewModel = _aimTimerViewModelFactory.Create(aimTimerItem);
     var aimTimerView      = _viewFactory.CreatePopupPage(aimTimerViewModel);
     await _navigation.PushPopupAsync(aimTimerView);
 }