private void button_changeTrigger_Click(object sender, RoutedEventArgs e)
        {
            var triggerDialog = new Microsoft.Win32.TaskScheduler.TriggerEditDialog();

            triggerDialog.ShowDialog();
            trigger = triggerDialog.Trigger;

            textBox_plannedTrigger.Text = trigger.ToString();
        }
        private void buttonCreateJob_Click(object sender, RoutedEventArgs e)
        {
            // If a trigger is defined
            if (trigger == null && !jobNowCheckbox.IsChecked.Value)
            {
                MessageBox.Show("Error : An execution trigger must be provided to the job", "Job creation error");
                return;
            }

            // Get the selected computers
            if (selectedComputersGrid.SelectedItems.Count <= 0)
            {
                MessageBox.Show("Error : No computer selected. At least one computer should be selected", "Job creation error");
                return;
            }

            var selectedComputers = new List <ComputerInfo>();

            foreach (Computer c in selectedComputersGrid.SelectedItems)
            {
                selectedComputers.Add(App.computerInfoStore.getComputerInfoByName(c.nameLong));
            }

            // Get the tasks
            var tasks = new List <JobTask>();

            foreach (dynamic element in tasksPanel.Children)
            {
                JobTask jobTask = element.createTask();

                if (jobTask == null)
                {
                    return; // Error during jobtask creation
                }
                tasks.Add(jobTask);
            }

            if (tasks.Count <= 0)
            {
                MessageBox.Show("Error : No task defined. At least one taks should be defined", "Job creation error");
                return;
            }

            // OK, create the job
            var job = new Scheduling.Job {
                creationDateTime   = DateTime.Now,
                cyclic             = jobCyclicCheckbox.IsChecked.Value,
                executeNow         = trigger == null,
                triggerDescription = trigger != null?trigger.ToString() : "As soon as possible",
                                         computers = selectedComputers,
                                         status    = JobStatus.SCHEDULED,
                                         tasks     = tasks,
                                         name      = textBox_TaskName.Text
            };

            // Insert into the job store
            App.jobStore.insertJob(job);

            // Create a windows task
            if (jobNowCheckbox.IsChecked.Value)
            {
                job.schedule();
            }
            else
            {
                job.schedule(trigger);
            }

            parent.updateScheduledJobs();

            reset();
        }