示例#1
0
        public void TimeRemainingTest()
        {
            string   timeRemaining = CycleService.TimeRemaining();
            TimeSpan time          = CycleService.TimeTillTick();

            Assert.IsTrue(timeRemaining.IndexOf("hour") > 0);
            if (time.Days == 0)
            {
                Assert.IsTrue(timeRemaining.IndexOf("minute") > 0);
            }
            else
            {
                Assert.IsTrue(timeRemaining.IndexOf("day") > 0);
            }
        }
示例#2
0
        private void UpdateTimeRemaining()
        {
            TimeRemaining = CycleService.TimeRemaining();
            CycleImminent = CycleService.CycleImminent();
            if (CycleImminent)
            {
                TimeRemainingColor = Color.DarkRed;
            }
            else
            {
                TimeRemainingColor = ThemeHelper.GetThemeColor("brandColor");
            }
            ShowTimeRemaining = !settings.OnlyShowNextCycleWhenImminent || CycleService.CycleImminent();

            if (pageVisible && (CycleService.FinalDay() || DateTime.UtcNow.Minute == 59))
            {
                Device.StartTimer(TimeSpan.FromSeconds(60 - DateTime.UtcNow.Second), () =>
                {
                    UpdateTimeRemaining();
                    return(false);
                });
            }
        }