Example #1
0
 public CreateChangePageBase()
 {
     viewModel = new ChangeActivityViewModel();
     viewModel.ActivityUpdated += viewModel_ActivityUpdated;
     this.navigationHelper      = new NavigationHelper(this);
     activityName = resourceLoader.GetString(Constants.RESOURCEKEY_ACTIVITYNAME_CHANGE);
 }
 private void DefaultViewModel_ActivityUpdated(ChangeActivityViewModel sender, string args)
 {
     if (!Frame.Navigate(typeof(MainPage), Constants.NAVIGATION_PARAMETER_CLEARLASTBACKENTRY))
     {
         throw new Exception("Failed to create navigate home after creating change");
     }
 }
Example #3
0
 public static void From(this ChangeActivityViewModel thisViewModel, ChangeActivityViewModel otherViewModel)
 {
     thisViewModel.Baby          = otherViewModel.Baby;
     thisViewModel.EndTime       = otherViewModel.EndTime;
     thisViewModel.HowBabyFelt   = otherViewModel.HowBabyFelt;
     thisViewModel.HowParentFelt = otherViewModel.HowParentFelt;
     thisViewModel.Id            = otherViewModel.Id;
     thisViewModel.Notes         = otherViewModel.Notes;
     thisViewModel.StartDate     = otherViewModel.StartDate;
     thisViewModel.NappiesUsed   = otherViewModel.NappiesUsed;
     thisViewModel.WipesUsed     = otherViewModel.WipesUsed;
 }
Example #4
0
 public static ChangeActivity AsModel(this ChangeActivityViewModel viewModel)
 {
     return(new ChangeActivity
     {
         Id = viewModel.Id,
         StartTime = viewModel.StartDate.ToUniversalTime(),
         EndTime = viewModel.EndTime.HasValue
                     ? viewModel.EndTime.Value.ToUniversalTime()
                     : (DateTimeOffset?)null,
         Notes = viewModel.Notes,
         HowBabyFelt = (int?)viewModel.HowBabyFelt,
         HowParentFelt = (int?)viewModel.HowParentFelt,
         NappiesUsed = viewModel.NappiesUsed,
         WipesUsed = viewModel.WipesUsed,
         BabyId = viewModel.Baby.Id
     });
 }
Example #5
0
        private void viewModel_ActivityUpdated(ChangeActivityViewModel sender, string args)
        {
            var settings = SettingsViewModel.Current;

            // We've just created a new change which invalidates any scheduled change
            // notifications so delete them
            if (!string.IsNullOrWhiteSpace(settings.NextChangeNotificationId))
            {
                var toastNotifier         = ToastNotificationManager.CreateToastNotifier();
                var scheduledNotificaiton = toastNotifier.GetScheduledToastNotifications()
                                            .SingleOrDefault(tn => tn.Id == settings.NextChangeNotificationId);
                if (scheduledNotificaiton != null)
                {
                    toastNotifier.RemoveFromSchedule(scheduledNotificaiton);
                }
            }

            settings.LastActivityScheduleGeneratedAt = DateTimeOffset.MinValue;
            settings.LastDataTrendsGeneratedAt       = DateTimeOffset.MinValue;
        }