protected virtual void Dispose(bool disposing) { if (disposed) { return; } if (disposing) { if (Timer != null) { Timer.Dispose(); Timer = null; } if (PauseEvent != null) { PauseEvent.Close(); PauseEvent.Dispose(); PauseEvent = null; } if (RunEvent != null) { RunEvent.Close(); RunEvent.Dispose(); RunEvent = null; } if (UnityFactory != null) { UnityFactory.Container.Dispose(); UnityFactory = null; } } disposed = true; }
public static Task Create(string taskName, ServiceProfile svcProfile, string configPrefix = null) { var container = new UnityFactory(taskName); var task = container.Create <ITask>() as Task; task.UnityFactory = container; task.ServiceProfile = svcProfile; task.Name = taskName; task.FullName = string.Format("{0}.{1}", task.Name, task.ActivityName); task.Profile = new TaskProfile(task, configPrefix); return(task); }