public void Run() { foreach (Workflow workflow in Workflows) { if (workflow.IsEnabled) { if (workflow.LaunchType == LaunchType.Startup) { var wfInstance = SpawnWorkflow(workflow.JobId); wfInstance.Start(); } else if (workflow.LaunchType == LaunchType.Periodic) { Action <object> callback = o => { var wf = (Workflow)o; if (!wf.IsRunning) { var wfInstance = SpawnWorkflow(wf.JobId); wfInstance.Start(); } }; var timer = new WexflowTimer(new TimerCallback(callback), workflow, workflow.Period); timer.Start(); } } } }
public void Run() { foreach (Workflow workflow in this.Workflows) { if (workflow.IsEnabled) { if (workflow.LaunchType == LaunchType.Startup) { workflow.Start(); } else if (workflow.LaunchType == LaunchType.Periodic) { Action <object> callback = o => { Workflow wf = (Workflow)o; if (!wf.IsRunning) { wf.Start(); } }; WexflowTimer timer = new WexflowTimer(new TimerCallback(callback), workflow, workflow.Period); timer.Start(); } } } }
private void ScheduleWorkflow(Workflow wf) { if (wf.IsEnabled) { if (wf.LaunchType == LaunchType.Startup) { wf.Start(); } else if (wf.LaunchType == LaunchType.Periodic) { Action <object> callback = o => { var workflow = o as Workflow; if (workflow != null && !workflow.IsRunning) { workflow.Start(); } }; var timer = new WexflowTimer(new TimerCallback(callback), wf, wf.Period); _wexflowTimers.Add(wf.Id, timer); timer.Start(); } } }
private void ScheduleWorkflow(Workflow wf) { if (wf.IsEnabled) { if (wf.LaunchType == LaunchType.Startup) { wf.Start(); } else if (wf.LaunchType == LaunchType.Periodic) { Action <object> callback = o => { var workflow = o as Workflow; if (workflow != null && !workflow.IsRunning) { workflow.Start(); } }; var timer = new WexflowTimer(new TimerCallback(callback), wf, wf.Period); if (!_wexflowTimers.ContainsKey(wf.Id)) { _wexflowTimers.Add(wf.Id, new List <WexflowTimer> { timer }); } else { foreach (var wt in _wexflowTimers[wf.Id]) { wt.Stop(); } _wexflowTimers[wf.Id].Add(timer); } timer.Start(); } } }