Exemple #1
0
        public void Update()
        {
            var now = DateTime.Now;

            var schedule = CountdownCalculator.GetSchedule(countdown, now);
            var progress = CountdownCalculator.GetProgress(schedule, now);

            if (timeToggled)
            {
                Time = CountdownCalculator.GetElapsedTime(schedule, now);
                Date = schedule.Started;
            }
            else
            {
                Time = CountdownCalculator.GetRemainingTime(schedule, now);
                Date = schedule.NextCycle;
            }

            ExpirationDate     = schedule.NextCycle;
            RepetitionCount    = schedule.NumberOfCycles;
            Expired            = schedule.Expired;
            DaysRemaining      = progress.DaysRemaining;
            DaysTotal          = progress.DaysTotal;
            ProgressPercentage = progress.ProgressPercentage;
        }
        public static int GetDaysRemaining(this Countdown countdown, DateTime now)
        {
            var schedule = CountdownCalculator.GetSchedule(countdown, now);
            var progress = CountdownCalculator.GetProgress(schedule, now);

            var daysRemaining = progress.DaysRemaining;

            return(daysRemaining);
        }