Changeset 2141 for trunk/eraser
- Timestamp:
- 5/16/2010 10:14:23 AM (3 years ago)
- File:
-
- 1 edited
-
trunk/eraser/Eraser/SchedulerPanel.cs (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/eraser/Eraser/SchedulerPanel.cs
r2138 r2141 54 54 ExecutorTasksCollection tasks = Program.eraserClient.Tasks; 55 55 foreach (Task task in tasks) 56 DisplayTask(task);56 CreateTask(task); 57 57 58 58 //Hook the event machinery to our class. Handle the task Added and Removed … … 62 62 } 63 63 64 private void DisplayTask(Task task) 64 #region List-View Task Management 65 private void CreateTask(Task task) 65 66 { 66 67 //Add the item to the list view … … 69 70 item.SubItems.Add(string.Empty); 70 71 71 //Set the tag of the item so we know which task on the LV corresponds72 // to the physical task object.72 //Set the tag of the item so we know which task on the list-view 73 //corresponds to the physical task object. 73 74 item.Tag = task; 74 75 75 76 //Add our event handlers to the task 76 task.TaskStarted += task_TaskStarted;77 task.ProgressChanged += task_ProgressChanged;78 task.TaskFinished += task_TaskFinished;77 task.TaskStarted += TaskStarted; 78 task.ProgressChanged += TaskProgressChanged; 79 task.TaskFinished += TaskFinished; 79 80 80 81 //Show the fields on the list view 81 82 UpdateTask(item); 83 84 //If the task is set to Run Immediately, then show that status. 85 if (task.Schedule == Schedule.RunNow) 86 item.SubItems[1].Text = S._("Queued for execution"); 82 87 } 83 88 … … 91 96 92 97 //Set the next run time of the task 93 if (task.Queued || task.Schedule == Schedule.RunNow) 94 { 98 if (task.Queued) 95 99 item.SubItems[1].Text = S._("Queued for execution"); 96 item.SubItems[2].Text = string.Empty;97 }98 100 else if (task.Schedule is RecurringSchedule) 99 101 item.SubItems[1].Text = ((task.Schedule as RecurringSchedule).NextRun. 100 102 ToString("F", CultureInfo.CurrentCulture)); 101 else if (task.Schedule == Schedule.RunManually )103 else if (task.Schedule == Schedule.RunManually || task.Schedule == Schedule.RunNow) 102 104 item.SubItems[1].Text = S._("Not queued"); 103 105 else … … 122 124 item.Group = scheduler.Groups["recurring"]; 123 125 } 124 126 #endregion 127 128 #region Task Event handlers 125 129 /// <summary> 126 130 /// Handles the Task Added event. … … 143 147 } 144 148 145 DisplayTask(e.Task);149 CreateTask(e.Task); 146 150 } 147 151 … … 190 194 /// </summary> 191 195 /// <param name="e">The task event object.</param> 192 void task_TaskStarted(object sender, EventArgs e)196 void TaskStarted(object sender, EventArgs e) 193 197 { 194 198 if (InvokeRequired) 195 199 { 196 Invoke((EventHandler) task_TaskStarted, sender, e);200 Invoke((EventHandler)TaskStarted, sender, e); 197 201 return; 198 202 } … … 215 219 /// Handles the progress event by the task. 216 220 /// </summary> 217 void task_ProgressChanged(object sender, ProgressChangedEventArgs e)221 void TaskProgressChanged(object sender, ProgressChangedEventArgs e) 218 222 { 219 223 //Make sure we handle the event in the main thread as this requires … … 221 225 if (InvokeRequired) 222 226 { 223 Invoke((EventHandler<ProgressChangedEventArgs>) task_ProgressChanged, sender, e);227 Invoke((EventHandler<ProgressChangedEventArgs>)TaskProgressChanged, sender, e); 224 228 return; 225 229 } … … 233 237 /// Handles the task completion event. 234 238 /// </summary> 235 void task_TaskFinished(object sender, EventArgs e)239 void TaskFinished(object sender, EventArgs e) 236 240 { 237 241 if (InvokeRequired) 238 242 { 239 Invoke((EventHandler) task_TaskFinished, sender, e);243 Invoke((EventHandler)TaskFinished, sender, e); 240 244 return; 241 245 } … … 323 327 } 324 328 } 325 329 #endregion 330 331 #region List-View Event handlers 326 332 /// <summary> 327 333 /// Occurs when the user presses a key on the list view. … … 750 756 DeleteSelectedTasks(); 751 757 } 758 #endregion 752 759 753 760 #region Item management
Note: See TracChangeset
for help on using the changeset viewer.
