Exemplo n.º 1
0
        private static IScheduledItem BaseRule(ScheduledRule rule)
        {
            if (rule == null)
            {
                return(null);
            }
            IScheduledItem result = null;

            try
            {
                string type;
                switch (type = rule.Rule.Type)
                {
                case "BySecond":
                case "ByMinute":
                case "Hourly":
                case "Daily":
                case "Weekly":
                case "Monthly":
                    result = new ScheduledTime(rule.Rule.Type, rule.Rule.Offest);
                    break;

                case "BySleep":
                    if (rule.Count == 0 && (rule.End == DateTime.MaxValue || rule.End == DateTime.MinValue))
                    {
                        result = new SimpleInterval(DateTime.Now, TimeSpan.Parse(rule.Rule.Offest));
                    }
                    else
                    {
                        if (rule.Count > 0)
                        {
                            result = new SimpleInterval(DateTime.Now, TimeSpan.Parse(rule.Rule.Offest), rule.Count);
                        }
                        else
                        {
                            if (rule.End != DateTime.MaxValue)
                            {
                                result = new SimpleInterval(DateTime.Now, TimeSpan.Parse(rule.Rule.Offest), rule.End);
                            }
                        }
                    }
                    break;
                }
            }
            catch
            {
            }
            return(result);
        }
Exemplo n.º 2
0
 public BlockWrapper(IScheduledItem item, string StrBase, string BeginOffset, string EndOffset)
 {
     this._Item  = item;
     this._Begin = new ScheduledTime(StrBase, BeginOffset);
     this._End   = new ScheduledTime(StrBase, EndOffset);
 }