コード例 #1
0
    public void ProcessServiceRequest(ServiceAction action, ScheduledTask task, int timeout)
    {
        ScheduledTaskConfig status = null;
        bool success = false;

        switch (action)
        {
        case ServiceAction.Query:
            break;

        case ServiceAction.Start:
            success = ScheduledTaskUtil.Start(task.Name, task.Server);
            break;

        case ServiceAction.Stop:
            success = ScheduledTaskUtil.Stop(task.Name, task.Server);
            break;

        case ServiceAction.Restart:
            success = ScheduledTaskUtil.Stop(task.Name, task.Server);
            System.Threading.Thread.Sleep(5000);
            success = ScheduledTaskUtil.Start(task.Name, task.Server);
            break;
        }

        status = ScheduledTaskUtil.QueryStatus(task.Name, task.Server);

        if (status != null)
        {
            OnLogMessage(action.ToString(), "Name : [" + status.Name + "] Status : [" + status.State + "]");
            results.Add(status);
        }
    }
 public IScheduledTask GetScheduledTaskFromConfig(ScheduledTaskConfig config)
 {
     return(LoadAssemblyIfNotLoadedAndGetScheduledTask(config.AssemblyFullPath, config.FullTypeName));
 }
コード例 #3
0
 public ScheduledTaskTracker(ScheduledTaskConfig config)
 {
     Config = config;
 }