Exemplo n.º 1
0
        public bool isEventTime()
        {
            bool     flag        = false;
            DateTime presentTime = getPresentTime();
            string   value       = ClockTime.Value;

            if (currentSchedule != value || nextDate <= presentTime)
            {
                flag = lastCheckTime <= nextDate && nextDate <= presentTime;
                if (!flag)
                {
                    flag = CronExpressionEvaluator.EvaluatesTrue(presentTime, value, out nextDate);
                }
                currentSchedule = value;
            }
            lastCheckTime = presentTime;
            TimeSpan timeSpan = nextDate.Subtract(presentTime);

            if (NextTime.Value != (int)timeSpan.TotalSeconds)
            {
                NextTime.Value      = (int)timeSpan.TotalSeconds;
                CountdownText.Value = ((int)Math.Floor(timeSpan.TotalMinutes)).ToString("D2") + ":" + timeSpan.Seconds.ToString("D2");
            }
            return(flag);
        }
Exemplo n.º 2
0
    public static CellPhoneRecurringLocationActivityDefinition GetActiveRecurringActivityDefinition(List <CellPhoneRecurringLocationActivityDefinition> activities)
    {
        CellPhoneRecurringLocationActivityDefinition result = null;

        for (int i = 0; i < activities.Count; i++)
        {
            DateTime dateTime = Service.Get <ContentSchedulerService>().ScheduledEventDate();
            if (CronExpressionEvaluator.EvaluatesTrue(dateTime, activities[i].ShowWidgetScheduleCron) && DateTimeUtils.DoesDateFallBetween(dateTime, activities[i].GetStartingDate().Date, activities[i].GetEndingDate().Date))
            {
                result = activities[i];
                break;
            }
        }
        return(result);
    }
        public void CheckDateAgainstSchedule()
        {
            DateTime presentTime = getPresentTime();
            string   value       = Schedule.Value;

            if (!string.IsNullOrEmpty(value))
            {
                if (shouldBeVisible() && CronExpressionEvaluator.EvaluatesTrue(presentTime, value))
                {
                    if (FinishEventTrue != null)
                    {
                        base.Fsm.Event(FinishEventTrue);
                    }
                }
                else if (FinishEventFalse != null)
                {
                    base.Fsm.Event(FinishEventFalse);
                }
            }
            if (FinishEventTrue == null && FinishEventFalse == null)
            {
            }
            Finish();
        }
 private void resetStartTime(string scheduleCron)
 {
     CronExpressionEvaluator.EvaluatesTrue(Service.Get <ContentSchedulerService>().PresentTime(), scheduleCron, out startTime);
 }