Ignore:
Timestamp:
2/8/2010 6:44:59 AM (2 years ago)
Author:
lowjoel
Message:

Removed the TaskProcessing? and TaskProcessed? events in Executor which duplicate the TaskStarted? and TaskFinished? events in Task. The TaskEventArgs? class can't disappear just yet as the TaskAdded? and TaskDeleted? events still need them (the sender is not the task, it's the executor) Addresses #275: Code Review

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eraser6/CodeReview/Eraser.Manager/DirectExecutor.cs

    r1745 r1765  
    2727using System.Threading; 
    2828using System.IO; 
     29using System.Runtime.Serialization; 
     30using System.Runtime.Serialization.Formatters.Binary; 
    2931 
    3032using Eraser.Util; 
    3133using Eraser.Util.ExtensionMethods; 
    32 using System.Security.Principal; 
    33 using System.Runtime.Serialization; 
    34 using System.Runtime.Serialization.Formatters.Binary; 
    35 using System.Security.Permissions; 
    3634 
    3735namespace Eraser.Manager 
     
    152150        } 
    153151 
    154         private void OnTaskEdited(object sender, TaskEventArgs e) 
     152        private void OnTaskEdited(object sender, EventArgs e) 
    155153        { 
    156154            //Find all schedule entries containing the task - since the user cannot make 
    157155            //edits to the task when it is queued (only if it is scheduled) remove 
    158156            //all task references and add them back 
     157            Task task = (Task)sender; 
    159158            lock (tasksLock) 
    160159                for (int i = 0; i != scheduledTasks.Count; ++i) 
     
    162161                    { 
    163162                        Task currentTask = scheduledTasks.Values[i][j]; 
    164                         if (currentTask == e.Task) 
     163                        if (currentTask == task) 
    165164                            scheduledTasks.Values[i].RemoveAt(j); 
    166165                        else 
     
    169168 
    170169            //Then reschedule the task 
    171             if (e.Task.Schedule is RecurringSchedule) 
    172                 ScheduleTask(e.Task); 
     170            if (task.Schedule is RecurringSchedule) 
     171                ScheduleTask(task); 
    173172        } 
    174173 
     
    248247                        //Broadcast the task started event. 
    249248                        task.Canceled = false; 
    250                         task.OnTaskStarted(new TaskEventArgs(task)); 
    251                         OnTaskProcessing(new TaskEventArgs(task)); 
     249                        task.OnTaskStarted(); 
    252250 
    253251                        //Run the task 
     
    318316 
    319317                        //And the task finished event. 
    320                         task.OnTaskFinished(new TaskEventArgs(task)); 
    321                         OnTaskProcessed(new TaskEventArgs(task)); 
     318                        task.OnTaskFinished(); 
    322319 
    323320                        //Remove the actively executing task from our instance variable 
Note: See TracChangeset for help on using the changeset viewer.