private void EnableTask(WlbScheduledTask task) { //If we are trying to enable the task, check to see if it is a duplicate before allowing it if (!task.Enabled) { //We need to pretend the task is enabled to check for duplicates WlbScheduledTask enabledTask = task.Clone(); enabledTask.Enabled = true; WlbScheduledTask checkTask = CheckForDuplicateTask(enabledTask); //if it's a duplicate task, display warning and return if (null != checkTask) { using (var dlg = new ThreeButtonDialog( new ThreeButtonDialog.Details( SystemIcons.Warning, Messages.WLB_TASK_SCHEDULE_CONFLICT_BLURB, Messages.WLB_TASK_SCHEDULE_CONFLICT_TITLE))) { dlg.ShowDialog(this); } SelectTask(checkTask.TaskId); return; } } task.Enabled = !task.Enabled; PopulateListView(); _hasChanged = true; }
private void EditTask(WlbScheduledTask task) { WlbScheduledTask editTask = task.Clone(); WlbEditScheduledTask taskEditor = new WlbEditScheduledTask(editTask); DialogResult dr = taskEditor.ShowDialog(); if (DialogResult.OK == dr) { WlbScheduledTask checkTask = CheckForDuplicateTask(editTask); if (null != checkTask) { using (var dlg = new ThreeButtonDialog( new ThreeButtonDialog.Details( SystemIcons.Warning, Messages.WLB_TASK_SCHEDULE_CONFLICT_BLURB, Messages.WLB_TASK_SCHEDULE_CONFLICT_TITLE))) { dlg.ShowDialog(this); } SelectTask(checkTask.TaskId); } else { editTask.LastTouchedBy = _pool.Connection.Username; editTask.LastTouched = DateTime.UtcNow; _scheduledTasks.TaskList[editTask.TaskId.ToString()] = editTask; PopulateListView(); _hasChanged = true; } } }