/// <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); }
/// <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); }
/// <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); }
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 }); }
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(); }
/// <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 }); }
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) { } }
/// <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; }
/// <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)); }
/// <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) { }
/// <summary> /// /// </summary> /// <returns></returns> public static PlanConfig OncePlan(PlanCallback callback, string name, string beginTime) { return(CreatePlan(callback, name, PlanCycle.Once, beginTime)); }
/// <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)); }
/// <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; }
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 }; }
/// <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) { }
/// <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); }
/// <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); }
/// <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); }
/// <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; }
/// <summary> /// /// </summary> /// <returns></returns> public static PlanConfig OncePlan(PlanCallback callback, string name, string beginTime) { return CreatePlan(callback, name, PlanCycle.Once, beginTime); }
/// <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 }; }
/// <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; }
/// <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); }
/// <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)); }
/// <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)); }