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;
         }
     }
 }
        private void AddTask()
        {
            WlbEditScheduledTask addTask = new WlbEditScheduledTask(_newTaskId--, WlbScheduledTask.WlbTaskActionType.SetOptimizationMode);
            DialogResult dr = addTask.ShowDialog();
            if (DialogResult.OK == dr)
            {
                WlbScheduledTask newTask = addTask.Task;
                newTask.Owner = _pool.Connection.Username;
                newTask.LastTouchedBy = _pool.Connection.Username;
                newTask.AddTaskParameter("PoolUUID", _pool.uuid);

                WlbScheduledTask checkTask = CheckForDuplicateTask(newTask);
                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
                {
                    _scheduledTasks.TaskList.Add(newTask.TaskId.ToString(), newTask);
                    PopulateListView();
                    _hasChanged = true;
                }
            }
        }