create a task using UI

Nov 19, 2012 at 7:27 PM

I am not an expert coder by any means so forgive me if this question is obvious.

I would like to create a object that stores all the task information from the editor UI.  I see how to edit an existing task but can I use the editor GUI to enter information for a new task?


Thank you in Advance.

Nov 20, 2012 at 2:11 PM

You can use either the TaskEditDialog or TaskSchedulerWizard and then just initialize them or construct them with just a TaskService instance. If you wish to register the task (make it effective on the system) you will need to set the RegisterTaskOnAccept property to true.

// Get the service on the local machine
using (TaskService ts = new TaskService())
   // Setup editor so that it will create a new task definition,
   // make it editable, and register it when user clicks Ok
   TaskEditDialog editorForm = new TaskEditDialog(ts);
   if (editorForm.ShowDialog() == DialogResult.OK)
      // The editorForm.TaskDefinition now contains all the
      // information the user input into the form.


Nov 20, 2012 at 2:52 PM

Thank you, this is exactly what I was looking for.