This project has moved. For the latest updates, please go here.

TaskPropertiesControl

Apr 4, 2012 at 10:52 AM

I notice that there is a property to disable the "run times" tab. How do I make use of this functionality when displaying properties via Task.ShowEditor()?

My problem is that the "run times" tab seems to cause an exception on my customer's server, and I really don't need to display this tab... If you run the Task Scheduler from windows, this tab is not even displayed...

Greg.

Coordinator
Apr 4, 2012 at 3:27 PM

You can't disable it with the ShowEditor method. You will need to reference Microsoft.Win32.TaskScheduler.dll in your project. Below is the code to use:

TaskEditDialog editorForm = new TaskEditDialog(task, true, true);
editorForm.ShowRunTimesTab = false;
editorForm.ShowDialog();
Apr 4, 2012 at 3:54 PM

ShowRunTimesTab is not a property/attribute of the TaskEditDialog class... so the code above is not valid.

Apr 4, 2012 at 4:08 PM

I got it right doing the following... not sure if there is a easier way...

            TaskEditDialog diag = new TaskEditDialog(t, true, true);
            TaskPropertiesControl prop = null;

            foreach (System.Windows.Forms.Control control in diag.Controls)
                if (control.Name.Equals("taskPropertiesControl1"))
                {
                    prop = (TaskPropertiesControl)control;
                    prop.ShowRunTimesTab = false;
                    break;
                }

            if (prop != null)
                diag.ShowDialog();
            else
                t.ShowEditor();

Coordinator
Apr 4, 2012 at 4:54 PM

The code I provided does work with version 1.8.1 of the library and any builds dated after Jan 27, 2012. For prior versions, your code is the only way to set it.

Apr 5, 2012 at 9:30 AM
shady5k wrote:

ShowRunTimesTab is not a property/attribute of the TaskEditDialog class... so the code above is not valid.

That's odd, because for me it is... TaskScheduler.TaskEditDialog that is...

My code:

TaskEditDialog editorForm = new TaskEditDialog();
editorForm.Editable = true;
editorForm.RegisterTaskOnAccept = true;
editorForm.Initialize(theTask);
editorForm.AllowTransparency = true;
editorForm.ShowRunTimesTab = false;
editorForm.ShowDialog();
Apr 10, 2012 at 6:36 AM

Thanks for the help. I seem to be using version 1.7.1