/// <summary> /// Creates a new task on the system with the given <paramref name="name" />. /// </summary> /// <remarks>Task names follow normal filename character restrictions. The name /// will be come the name of the file used to store the task (with .job added).</remarks> /// <param name="name">Name for the new task.</param> /// <returns>Instance of new task.</returns> /// <exception cref="ArgumentException">There is an existing task with the given name.</exception> public Task CreateTask(string name) { Task tester = OpenTask(name); if (tester != null) { tester.Close(); throw new ArgumentException("The task \"" + name + "\" already exists."); } try { object o; its.NewWorkItem(name, ref CTaskGuid, ref ITaskGuid, out o); ITask iTask = (ITask)o; return(new Task(iTask, name)); } catch { return(null); } }