示例#1
0
 /// <summary>
 /// Pressed ADD button, add a new job
 /// </summary>
 private void AddToolStripButton_Click(object sender, EventArgs e)
 {
     bool OK = false;
     // Get the name, must be unique
     SchedulerNameDialog snd = new SchedulerNameDialog();
     do
     {
         if (snd.ShowDialog() == DialogResult.Cancel) return;
         OK = this.SchedulerDataSet.Jobs.FindByName(snd.BackupName) == null;
         if (!OK) MessageBox.Show("Backup name " + snd.BackupName + " is already used.");
     } while (!OK);
     this.Cursor = Cursors.WaitCursor;
     // Fire up the editor
     JobDialog sd = new JobDialog(this.SchedulerDataSet.Jobs.NewJobsRow(snd.BackupName));
     if (sd.ShowDialog() == DialogResult.OK && NewTask(sd.Row, sd.Trigger))
     {
         // Add this to the database
         this.SchedulerDataSet.Jobs.AddJobsRow(sd.Row);
         Save(sd.Row);
         this.jobSummary1.Enabled = sd.Row.Enabled;
     }
     this.Cursor = Cursors.Default;
 }
示例#2
0
 /// <summary>
 /// Pressed the EDIT button
 /// </summary>
 private void EditToolStripButton_Click(object sender, EventArgs e)
 {
     if (CurrentRow == null) return;
     this.Cursor = Cursors.WaitCursor;
     // Fire up the editor
     JobDialog sd = new JobDialog(CurrentRow);
     // Get the trigger
     sd.Trigger = TaskScheduler.GetTrigger(CurrentRow.TaskName);
     // User said OK and the Task Scheduler took it OK, so save it
     if (sd.ShowDialog() == DialogResult.OK && NewTask(sd.Row, sd.Trigger))
     {
         // Save the edited row
         Save(sd.Row);
         this.jobSummary1.Enabled = sd.Row.Enabled;
     }
     // Updates the screen
     JobsBindingSource_CurrentChanged(null, null);
     this.Cursor = Cursors.Default;  // Should be in a 'finnaly'
 }