Пример #1
0
 public void TaskButtonClick(object sender, MouseEventArgs e) {
     TaskButton TaskButtonObject = (TaskButton)sender;
     TaskForm TaskFormObject = new TaskForm(ref TaskButtonObject.TaskObject);
     TaskFormObject.ShowDialog();
     if (TaskFormObject.TaskObject != null) {
         if (TaskFormObject.PerformDeletion) {
             TaskCollectionObject.TaskList.Remove(TaskFormObject.TaskObject);
             TaskButtonObject.Dispose();
             TotalTasksLabel.Text = "Total Tasks : " + TaskCollectionObject.TaskList.Count;
             if (TaskCollectionObject.TaskList.Count > 0) SortByChangeEnabled(true);
             else SortByChangeEnabled(false);
         } else {
             int TaskIndex = TaskCollectionObject.TaskList.FindIndex(tO => tO.ID == TaskFormObject.TaskObject.ID);
             if (TaskIndex >= 0) {
                 TaskCollectionObject.TaskList[TaskIndex] = TaskFormObject.TaskObject;
                 TaskButtonObject.Initialize(ref TaskFormObject.TaskObject);
                 TaskButtonObject.Invalidate();
             }
         }
     }
 }
Пример #2
0
 private void AddTaskButtonClick(object sender, EventArgs e) {
     TaskForm TaskFormObject = new TaskForm();
     TaskFormObject.ShowDialog();
     if (TaskFormObject.TaskObject != null) {
         TaskCollectionObject.TaskList.Add(TaskFormObject.TaskObject);
         PopulateTasksWithoutThread(TaskFormObject.TaskObject);
         TotalTasksLabel.Text = "Total Tasks : " + TaskCollectionObject.TaskList.Count;
         if (TaskCollectionObject.TaskList.Count > 0) SortByChangeEnabled(true);
         Options.LastTaskID++;
     }
 }