示例#1
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public static PlanConfig EveryWeekPlan(PlanCallback callback, string name, DayOfWeek week, string beginTime, string endTime, int secondInterval = 60)
        {
            var plan = CreatePlan(callback, name, PlanCycle.Week, beginTime, endTime, true, secondInterval);

            plan.PlanWeek = week;
            return(plan);
        }
示例#2
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public static PlanConfig EveryWeekPlan(PlanCallback callback, string name, DayOfWeek week, string beginTime)
        {
            var plan = CreatePlan(callback, name, PlanCycle.Week, beginTime);

            plan.PlanWeek = week;
            return(plan);
        }
示例#3
0
        /// <summary>
        /// Every week run
        /// </summary>
        /// <param name="callback"></param>
        /// <param name="name"></param>
        /// <param name="week">DayOfWeek</param>
        /// <param name="beginTime">more than or equal this time, format: "2015/01/01 09:00:00", or "09:00:00" is today time</param>
        /// <param name="target"></param>
        /// <returns></returns>
        public static PlanConfig EveryWeekPlan(PlanCallback callback, string name, DayOfWeek week, string beginTime, object target = null)
        {
            var plan = CreatePlan(callback, name, PlanCycle.Week, beginTime, null, false, 0, target);

            plan.PlanWeek = week;
            return(plan);
        }
示例#4
0
 private static PlanConfig CreatePlan(PlanCallback callback, string name, PlanCycle planCycle, string beginTime, string endTime = "", bool isCycle = false, int secondInterval = 0)
 {
     return(new PlanConfig()
     {
         Callback = callback,
         Name = name,
         PlanCycle = planCycle,
         BeginTime = beginTime,
         EndTime = endTime,
         IsCycle = isCycle,
         SecondInterval = secondInterval
     });
 }
示例#5
0
        private PlanConfig(PlanCallback callback, PlanCycle planCycle, string beginTime, string endTime, bool isCycle, int secondInterval, string name)
        {
            Callback       = callback;
            _planCycle     = planCycle;
            _beginTime     = beginTime;
            Name           = name;
            _endTime       = string.IsNullOrEmpty(endTime) ? "23:59:59" : endTime;
            IsCycle        = isCycle;
            SecondInterval = secondInterval > 0 ? secondInterval : 0;

            _beginDate = _beginTime.ToDateTime();
            _endDate   = _endTime.ToDateTime();
        }
示例#6
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="callback"></param>
 /// <param name="name"></param>
 /// <param name="planCycle">PlanCycle</param>
 /// <param name="beginTime">more than or equal this time, format: "2015/01/01 09:00:00", or "09:00:00" is today time</param>
 /// <param name="endTime">less than this time, format: "2015/01/02 00:00:00", or "00:00:00" or "null" is tomorrow time</param>
 /// <param name="isCycle">is cycle run</param>
 /// <param name="secondInterval">interval run times</param>
 /// <param name="target"></param>
 /// <returns></returns>
 private static PlanConfig CreatePlan(PlanCallback callback, string name, PlanCycle planCycle, string beginTime, string endTime, bool isCycle, int secondInterval, object target)
 {
     return(new PlanConfig()
     {
         Callback = callback,
         Name = name,
         PlanCycle = planCycle,
         BeginTime = beginTime,
         EndTime = endTime ?? string.Empty,
         IsCycle = isCycle,
         SecondInterval = secondInterval,
         Target = target
     });
 }
示例#7
0
 public sortMethod(sortType t, string parm, PlanCallback f)
 {
     _f = f;
     if (sortType.None == t)
     {
     }
     else if (sortType.Interval == t)
     {
         string [] p = parm.Split(',');
         int       p1 = 0, p2 = 0;
         try
         {
             p1 = int.Parse(p[0]);
             p2 = int.Parse(p[1]);
         }
         catch (Exception e)
         {
             p1 = 1000;
             p2 = 1000 * 60 * 60;
         }
         _timer = new Timer(timeCb, null, p1, p2);
     }
     else if (sortType.Timing == t)
     {
         string[] timers = parm.Split(',');
         for (int i = 0; i < timers.Length; ++i)
         {
             try
             {
                 DateTime dt = Convert.ToDateTime(timers[i]);
             }
             catch (Exception e)
             {
                 ConsoleLog.showErrorInfo(i, e.Message + ":datePase Error;" + timers[i]);
                 continue;
             }
             TimeListener.Append(PlanConfig.EveryDayPlan(_f, "EveryDayTask", timers[i]));
         }
     }
     else if (sortType.week == t)
     {
     }
 }
示例#8
0
 /// <summary>
 /// Every week run
 /// </summary>
 /// <param name="callback"></param>
 /// <param name="name"></param>
 /// <param name="week">DayOfWeek</param>
 /// <param name="beginTime">more than or equal this time, format: "2015/01/01 09:00:00", or "09:00:00" is today time</param>
 /// <param name="target"></param>
 /// <returns></returns>
 public static PlanConfig EveryWeekPlan(PlanCallback callback, string name, DayOfWeek week, string beginTime, object target = null)
 {
     var plan = CreatePlan(callback, name, PlanCycle.Week, beginTime, null, false, 0, target);
     plan.PlanWeek = week;
     return plan;
 }
示例#9
0
 /// <summary>
 ///
 /// </summary>
 /// <returns></returns>
 public static PlanConfig EveryDayPlan(PlanCallback callback, string name, string beginTime)
 {
     return(CreatePlan(callback, name, PlanCycle.Day, beginTime, "23:59:59", true, (int)new TimeSpan(1, 0, 0, 0).TotalSeconds));
 }
示例#10
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="callback"></param>
 /// <param name="beginTime"></param>
 /// <param name="endTime"></param>
 /// <param name="isCycle"></param>
 /// <param name="secondInterval"></param>
 /// <param name="name"></param>
 public PlanConfig(PlanCallback callback, string beginTime, string endTime, bool isCycle = false, int secondInterval = 0, string name = "")
     : this(callback, PlanCycle.Day, beginTime, endTime, isCycle, secondInterval, name)
 {
 }
示例#11
0
 /// <summary>
 ///
 /// </summary>
 /// <returns></returns>
 public static PlanConfig OncePlan(PlanCallback callback, string name, string beginTime)
 {
     return(CreatePlan(callback, name, PlanCycle.Once, beginTime));
 }
示例#12
0
 /// <summary>
 ///
 /// </summary>
 /// <returns></returns>
 public static PlanConfig EveryMinutePlan(PlanCallback callback, string name, string beginTime, string endTime, int secondInterval = 60)
 {
     return(CreatePlan(callback, name, PlanCycle.Day, beginTime, endTime, true, secondInterval));
 }
示例#13
0
 /// <summary>
 /// 第几周
 /// </summary>
 /// <param name="callback"></param>
 /// <param name="week"></param>
 /// <param name="beginTime"></param>
 /// <param name="endTime"></param>
 /// <param name="secondInterval"></param>
 /// <param name="isCycle"></param>
 /// <param name="name"></param>
 public PlanConfig(PlanCallback callback, DayOfWeek week, string beginTime, string endTime, bool isCycle = true, int secondInterval = 0, string name = "")
     : this(callback, PlanCycle.Week, beginTime, endTime, isCycle, secondInterval, name)
 {
     _week = week;
 }
示例#14
0
 private static PlanConfig CreatePlan(PlanCallback callback, string name, PlanCycle planCycle, string beginTime, string endTime = "", bool isCycle = false, int secondInterval = 0)
 {
     return new PlanConfig()
     {
         Callback = callback,
         Name = name,
         PlanCycle = planCycle,
         BeginTime = beginTime,
         EndTime = endTime,
         IsCycle = isCycle,
         SecondInterval = secondInterval
     };
 }
示例#15
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="callback"></param>
 /// <param name="isCycle"></param>
 /// <param name="secondInterval"></param>
 /// <param name="name"></param>
 public PlanConfig(PlanCallback callback, bool isCycle, int secondInterval, string name = "")
     : this(callback, PlanCycle.Day, "00:00", null, isCycle, secondInterval, name)
 {
 }
示例#16
0
 /// <summary>
 /// 
 /// </summary>
 /// <returns></returns>
 public static PlanConfig EveryDayPlan(PlanCallback callback, string name, string beginTime)
 {
     return CreatePlan(callback, name, PlanCycle.Day, beginTime, "23:59:59", true, (int)new TimeSpan(1, 0, 0, 0).TotalSeconds);
 }
示例#17
0
 /// <summary>
 /// Only run once
 /// </summary>
 /// <param name="callback"></param>
 /// <param name="name"></param>
 /// <param name="beginTime">equal this time, format:"2015/01/01 09:00:00", or "09:00:00"  is today time</param>
 /// <param name="target"></param>
 /// <returns></returns>
 public static PlanConfig OncePlan(PlanCallback callback, string name, string beginTime, object target = null)
 {
     return CreatePlan(callback, name, PlanCycle.Once, beginTime, null, false, 0, target);
 }
示例#18
0
 /// <summary>
 /// Every day run
 /// </summary>
 /// <param name="callback"></param>
 /// <param name="name"></param>
 /// <param name="beginTime">more than or equal this time, format: "2015/01/01 09:00:00", or "09:00:00" is today time</param>
 /// <param name="target"></param>
 /// <returns></returns>
 public static PlanConfig EveryDayPlan(PlanCallback callback, string name, string beginTime, object target = null)
 {
     return CreatePlan(callback, name, PlanCycle.Day, beginTime, null, true, (int)new TimeSpan(1, 0, 0, 0).TotalSeconds, target);
 }
示例#19
0
        private PlanConfig(PlanCallback callback, PlanCycle planCycle, string beginTime, string endTime, bool isCycle, int secondInterval, string name)
        {
            Callback = callback;
            _planCycle = planCycle;
            _beginTime = beginTime;
            Name = name;
            _endTime = string.IsNullOrEmpty(endTime) ? "23:59:59" : endTime;
            IsCycle = isCycle;
            SecondInterval = secondInterval > 0 ? secondInterval : 0;

            _beginDate = _beginTime.ToDateTime();
            _endDate = _endTime.ToDateTime();
        }
示例#20
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="callback"></param>
 /// <param name="beginTime"></param>
 /// <param name="endTime"></param>
 /// <param name="isCycle"></param>
 /// <param name="secondInterval"></param>
 /// <param name="name"></param>
 public PlanConfig(PlanCallback callback, string beginTime, string endTime, bool isCycle = false, int secondInterval = 0, string name = "")
     : this(callback, PlanCycle.Day, beginTime, endTime, isCycle, secondInterval, name)
 {
 }
示例#21
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="callback"></param>
 /// <param name="isCycle"></param>
 /// <param name="secondInterval"></param>
 /// <param name="name"></param>
 public PlanConfig(PlanCallback callback, bool isCycle, int secondInterval, string name = "")
     : this(callback, PlanCycle.Day, "00:00", null, isCycle, secondInterval, name)
 {
 }
示例#22
0
 /// <summary>
 /// Every week run
 /// </summary>
 /// <param name="callback"></param>
 /// <param name="name"></param>
 /// <param name="week">DayOfWeek</param>
 /// <param name="beginTime">more than or equal this time, format: "2015/01/01 09:00:00", or "09:00:00" is today time</param>
 /// <param name="endTime">less than this time, format: "2015/01/02 00:00:00", or "00:00:00" or "null" is tomorrow time</param>
 /// <param name="secondInterval">interval run times</param>
 /// <param name="target"></param>
 /// <returns></returns>
 public static PlanConfig EveryWeekPlan(PlanCallback callback, string name, DayOfWeek week, string beginTime, string endTime, int secondInterval = 60, object target = null)
 {
     var plan = CreatePlan(callback, name, PlanCycle.Week, beginTime, endTime, true, secondInterval, target);
     plan.PlanWeek = week;
     return plan;
 }
示例#23
0
 /// <summary>
 /// 
 /// </summary>
 /// <returns></returns>
 public static PlanConfig OncePlan(PlanCallback callback, string name, string beginTime)
 {
     return CreatePlan(callback, name, PlanCycle.Once, beginTime);
 }
示例#24
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="callback"></param>
 /// <param name="name"></param>
 /// <param name="planCycle">PlanCycle</param>
 /// <param name="beginTime">more than or equal this time, format: "2015/01/01 09:00:00", or "09:00:00" is today time</param>
 /// <param name="endTime">less than this time, format: "2015/01/02 00:00:00", or "00:00:00" or "null" is tomorrow time</param>
 /// <param name="isCycle">is cycle run</param>
 /// <param name="secondInterval">interval run times</param>
 /// <param name="target"></param>
 /// <returns></returns>
 private static PlanConfig CreatePlan(PlanCallback callback, string name, PlanCycle planCycle, string beginTime, string endTime, bool isCycle, int secondInterval, object target)
 {
     return new PlanConfig()
     {
         Callback = callback,
         Name = name,
         PlanCycle = planCycle,
         BeginTime = beginTime,
         EndTime = endTime ?? string.Empty,
         IsCycle = isCycle,
         SecondInterval = secondInterval,
         Target = target
     };
 }
示例#25
0
 /// <summary>
 /// 
 /// </summary>
 /// <returns></returns>
 public static PlanConfig EveryWeekPlan(PlanCallback callback, string name, DayOfWeek week, string beginTime)
 {
     var plan = CreatePlan(callback, name, PlanCycle.Week, beginTime);
     plan.PlanWeek = week;
     return plan;
 }
示例#26
0
 /// <summary>
 /// Every minute run
 /// </summary>
 /// <param name="callback"></param>
 /// <param name="name"></param>
 /// <param name="beginTime">more than or equal this time, format: "2015/01/01 09:00:00", or "09:00:00" is today time</param>
 /// <param name="endTime">less than this time, format: "2015/01/02 00:00:00", or "00:00:00" or "null" is tomorrow time</param>
 /// <param name="secondInterval">interval run times</param>
 /// <param name="target"></param>
 /// <returns></returns>
 public static PlanConfig EveryMinutePlan(PlanCallback callback, string name, string beginTime, string endTime, int secondInterval = 60, object target = null)
 {
     return CreatePlan(callback, name, PlanCycle.Day, beginTime, endTime, true, secondInterval, target);
 }
示例#27
0
 /// <summary>
 /// Only run once
 /// </summary>
 /// <param name="callback"></param>
 /// <param name="name"></param>
 /// <param name="beginTime">equal this time, format:"2015/01/01 09:00:00", or "09:00:00"  is today time</param>
 /// <param name="target"></param>
 /// <returns></returns>
 public static PlanConfig OncePlan(PlanCallback callback, string name, string beginTime, object target = null)
 {
     return(CreatePlan(callback, name, PlanCycle.Once, beginTime, null, false, 0, target));
 }
示例#28
0
 /// <summary>
 /// Every day run
 /// </summary>
 /// <param name="callback"></param>
 /// <param name="name"></param>
 /// <param name="beginTime">more than or equal this time, format: "2015/01/01 09:00:00", or "09:00:00" is today time</param>
 /// <param name="target"></param>
 /// <returns></returns>
 public static PlanConfig EveryDayPlan(PlanCallback callback, string name, string beginTime, object target = null)
 {
     return(CreatePlan(callback, name, PlanCycle.Day, beginTime, null, true, (int)new TimeSpan(1, 0, 0, 0).TotalSeconds, target));
 }
示例#29
0
 /// <summary>
 /// 第几周
 /// </summary>
 /// <param name="callback"></param>
 /// <param name="week"></param>
 /// <param name="beginTime"></param>
 /// <param name="endTime"></param>
 /// <param name="secondInterval"></param>
 /// <param name="isCycle"></param>
 /// <param name="name"></param>
 public PlanConfig(PlanCallback callback, DayOfWeek week, string beginTime, string endTime, bool isCycle = true, int secondInterval = 0, string name = "")
     : this(callback, PlanCycle.Week, beginTime, endTime, isCycle, secondInterval, name)
 {
     _week = week;
 }