Exemplo n.º 1
0
        void ScheduleNotifications()
        {
            var schedule = _data.GetExerciseSchedule();

            var now      = DateTime.Now;
            var tomorrow = now.AddDays(1);
            var random   = new Random();

            for (var testDate = TickUtility.GetNextRunTime(schedule); testDate < tomorrow; testDate = TickUtility.GetNextRunTime(schedule, testDate))
            {
                //TODO: figure out how to make this more random. Right now it makes a random schedule, but it's the same every day
                var exercise = _data.GetNextEnabledExercise(random);
                LocalNotifications.CreateNotification(testDate, exercise, true);
            }
        }
Exemplo n.º 2
0
        public void AddInstantExerciseNotificationAndRestartService(string exerciseName, int exerciseQuantity)
        {
            //TODO: Re-activate if we ever figure out notified thing on iOS
            //if (!string.IsNullOrEmpty(exerciseName) && exerciseQuantity > 0)
            //{
            //	_data.MarkExerciseNotified(exerciseName, -1 * exerciseQuantity);
            //}

            var nextExercise =
                _data.GetNextEnabledExercise();

            UIApplication.SharedApplication.CancelAllLocalNotifications();
            LocalNotifications.CreateInstantNotification(nextExercise);
            ScheduleNotifications();
        }