Changeset 944


Ignore:
Timestamp:
05/01/09 03:14:31 (6 years ago)
Author:
lowjoel
Message:

Fixed a few documentation inconsistencies and changed the event handler delegate types such that all event handlers use the EventArgs?<> generic.

Location:
branches/eraser6
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • branches/eraser6/Eraser/MainForm.cs

    r917 r944  
    4848 
    4949            //Connect to the executor task processing and processed events. 
    50             Program.eraserClient.TaskProcessing += 
    51                 new Executor.TaskProcessingEvent(OnTaskProcessing); 
    52             Program.eraserClient.TaskProcessed += 
    53                 new Executor.TaskProcessedEvent(OnTaskProcessed); 
     50            Program.eraserClient.TaskProcessing += OnTaskProcessing; 
     51            Program.eraserClient.TaskProcessed += OnTaskProcessed; 
    5452 
    5553            //Check the notification area context menu's minimise to tray item. 
     
    257255 
    258256        #region Task processing code (for notification area animation) 
    259         void OnTaskProcessing(Eraser.Manager.Task task) 
     257        void OnTaskProcessing(object sender, TaskEventArgs e) 
    260258        { 
    261259            if (InvokeRequired) 
    262260            { 
    263                 Invoke(new Executor.TaskProcessingEvent(OnTaskProcessing), task); 
     261                Invoke(new EventHandler<TaskEventArgs>(OnTaskProcessing), sender, e); 
    264262                return; 
    265263            } 
    266264 
    267             string iconText = S._("Eraser") + " - " + S._("Processing:") + ' ' + task.UIText; 
     265            string iconText = S._("Eraser") + " - " + S._("Processing:") + ' ' + e.Task.UIText; 
    268266            if (iconText.Length >= 64) 
    269267                iconText = iconText.Remove(60) + "..."; 
     
    274272        } 
    275273 
    276         void OnTaskProcessed(Eraser.Manager.Task task) 
     274        void OnTaskProcessed(object sender, TaskEventArgs e) 
    277275        { 
    278276            if (InvokeRequired) 
    279277            { 
    280                 Invoke(new Executor.TaskProcessedEvent(OnTaskProcessed), task); 
     278                Invoke(new EventHandler<TaskEventArgs>(OnTaskProcessed), sender, e); 
    281279                return; 
    282280            } 
  • branches/eraser6/Eraser/ProgressForm.cs

    r920 r944  
    4545            //Register the event handlers 
    4646            jobTitle.Text = task.UIText; 
    47             task.ProgressChanged += new Task.ProgressEventFunction(task_ProgressChanged); 
    48             task.TaskFinished += new Task.TaskEventFunction(task_TaskFinished); 
     47            task.ProgressChanged += task_ProgressChanged; 
     48            task.TaskFinished += task_TaskFinished; 
    4949        } 
    5050 
    5151        private void ProgressForm_FormClosed(object sender, FormClosedEventArgs e) 
    5252        { 
    53             task.ProgressChanged -= new Task.ProgressEventFunction(task_ProgressChanged); 
    54             task.TaskFinished -= new Task.TaskEventFunction(task_TaskFinished); 
     53            task.ProgressChanged -= task_ProgressChanged; 
     54            task.TaskFinished -= task_TaskFinished; 
    5555        } 
    5656 
    57         void task_ProgressChanged(TaskProgressEventArgs e) 
     57        void task_ProgressChanged(object sender, TaskProgressEventArgs e) 
    5858        { 
    5959            if (InvokeRequired) 
    6060            { 
    61                 Task.ProgressEventFunction func = 
    62                     new Task.ProgressEventFunction(task_ProgressChanged); 
    63                 Invoke(func, new object[] {e}); 
     61                Invoke(new EventHandler<TaskProgressEventArgs>(task_ProgressChanged), sender, e); 
    6462                return; 
    6563            } 
     
    8381        } 
    8482 
    85         void task_TaskFinished(TaskEventArgs e) 
     83        void task_TaskFinished(object sender, TaskEventArgs e) 
    8684        { 
    8785            if (InvokeRequired) 
    8886            { 
    89                 Task.TaskEventFunction func = 
    90                     new Task.TaskEventFunction(task_TaskFinished); 
    91                 Invoke(func, new object[] { e }); 
     87                Invoke(new EventHandler<TaskEventArgs>(task_TaskFinished), sender, e); 
    9288                return; 
    9389            } 
  • branches/eraser6/Eraser/SchedulerPanel.cs

    r920 r944  
    6565 
    6666            //Add our event handlers to the task 
    67             task.TaskStarted += new Task.TaskEventFunction(task_TaskStarted); 
    68             task.ProgressChanged += new Task.ProgressEventFunction(task_ProgressChanged); 
    69             task.TaskFinished += new Task.TaskEventFunction(task_TaskFinished); 
     67            task.TaskStarted += task_TaskStarted; 
     68            task.ProgressChanged += task_ProgressChanged; 
     69            task.TaskFinished += task_TaskFinished; 
    7070 
    7171            //Show the fields on the list view 
     
    111111        } 
    112112 
    113         private void TaskAdded(Task task) 
     113        /// <summary> 
     114        /// Handles the Task Added event. 
     115        /// </summary> 
     116        private void TaskAdded(object sender, TaskEventArgs e) 
    114117        { 
    115118            if (InvokeRequired) 
    116119            { 
    117                 Invoke(new Executor.TaskAddedEvent(TaskAdded), new object[] { task }); 
     120                Invoke(new EventHandler<TaskEventArgs>(TaskAdded), sender, e); 
    118121                return; 
    119122            } 
     
    124127            { 
    125128                parent.ShowNotificationBalloon(S._("New task added"), S._("{0} " + 
    126                     "has just been added to the list of tasks.", task.UIText), 
     129                    "has just been added to the list of tasks.", e.Task.UIText), 
    127130                    ToolTipIcon.Info); 
    128131            } 
    129132 
    130             DisplayTask(task); 
     133            DisplayTask(e.Task); 
    131134        } 
    132135 
     
    134137        /// Handles the task deleted event. 
    135138        /// </summary> 
    136         /// <param name="task">The task being deleted.</param> 
    137         private void TaskDeleted(Task task) 
     139        private void TaskDeleted(object sender, TaskEventArgs e) 
    138140        { 
    139141            if (InvokeRequired) 
    140142            { 
    141                 Invoke(new Executor.TaskDeletedEvent(TaskDeleted), new object[] { task }); 
     143                Invoke(new EventHandler<TaskEventArgs>(TaskDeleted), sender, e); 
    142144                return; 
    143145            } 
    144146 
    145147            foreach (ListViewItem item in scheduler.Items) 
    146                 if (((Task)item.Tag) == task) 
     148                if (((Task)item.Tag) == e.Task) 
    147149                { 
    148150                    scheduler.Items.Remove(item); 
     
    155157        /// </summary> 
    156158        /// <param name="e">The task event object.</param> 
    157         void task_TaskStarted(TaskEventArgs e) 
     159        void task_TaskStarted(object sender, TaskEventArgs e) 
    158160        { 
    159161            if (scheduler.InvokeRequired) 
    160162            { 
    161                 Task.TaskEventFunction func = 
    162                     new Task.TaskEventFunction(task_TaskStarted); 
    163                 Invoke(func, new object[] { e }); 
     163                Invoke(new EventHandler<TaskEventArgs>(task_TaskStarted), sender, e); 
    164164                return; 
    165165            } 
     
    181181        /// Handles the progress event by the task. 
    182182        /// </summary> 
    183         /// <param name="e">Event Argument.</param> 
    184         void task_ProgressChanged(TaskProgressEventArgs e) 
     183        void task_ProgressChanged(object sender, TaskProgressEventArgs e) 
    185184        { 
    186185            //Make sure we handle the event in the main thread as this requires 
     
    188187            if (scheduler.InvokeRequired) 
    189188            { 
    190                 Task.ProgressEventFunction func = 
    191                     new Task.ProgressEventFunction(task_ProgressChanged); 
    192                 Invoke(func, new object[] { e }); 
     189                Invoke(new EventHandler<TaskProgressEventArgs>(task_ProgressChanged), sender, e); 
    193190                return; 
    194191            } 
     
    201198        /// Handles the task completion event. 
    202199        /// </summary> 
    203         /// <param name="e">The task event object.</param> 
    204         void task_TaskFinished(TaskEventArgs e) 
     200        void task_TaskFinished(object sender, TaskEventArgs e) 
    205201        { 
    206202            if (InvokeRequired) 
    207203            { 
    208                 Task.TaskEventFunction func = 
    209                     new Task.TaskEventFunction(task_TaskFinished); 
    210                 Invoke(func, new object[] { e }); 
     204                Invoke(new EventHandler<TaskEventArgs>(task_TaskFinished), sender, e); 
    211205                return; 
    212206            } 
  • branches/eraser6/Eraser/SettingsPanel.cs

    r939 r944  
    4646 
    4747            //For new plugins, register the callback. 
    48             Host.Instance.PluginLoaded += new EventHandler<PluginLoadedEventArgs>(OnNewPluginLoaded); 
    49             ErasureMethodManager.MethodRegistered += 
    50                 new ErasureMethodManager.MethodRegisteredFunction(OnMethodRegistered); 
    51             ErasureMethodManager.MethodUnregistered += 
    52                 new ErasureMethodManager.MethodUnregisteredFunction(OnMethodUnregistered); 
     48            Host.Instance.PluginLoaded += OnNewPluginLoaded; 
     49            ErasureMethodManager.MethodRegistered += OnMethodRegistered; 
     50            ErasureMethodManager.MethodUnregistered += OnMethodUnregistered; 
    5351 
    5452            //Load the values 
     
    8886        } 
    8987 
    90         private void OnMethodRegistered(Guid guid) 
    91         { 
    92             ErasureMethod method = ErasureMethodManager.GetInstance(guid); 
     88        private void OnMethodRegistered(object sender, ErasureMethodRegistrationEventArgs e) 
     89        { 
     90            ErasureMethod method = ErasureMethodManager.GetInstance(e.Guid); 
    9391            eraseFilesMethod.Items.Add(method); 
    9492            if (method is UnusedSpaceErasureMethod) 
     
    9694        } 
    9795 
    98         private void OnMethodUnregistered(Guid guid) 
     96        private void OnMethodUnregistered(object sender, ErasureMethodRegistrationEventArgs e) 
    9997        { 
    10098            foreach (object obj in eraseFilesMethod.Items) 
    101                 if (((ErasureMethod)obj).Guid == guid) 
     99                if (((ErasureMethod)obj).Guid == e.Guid) 
    102100                { 
    103101                    eraseFilesMethod.Items.Remove(obj); 
     
    106104 
    107105            foreach (object obj in eraseUnusedMethod.Items) 
    108                 if (((ErasureMethod)obj).Guid == guid) 
     106                if (((ErasureMethod)obj).Guid == e.Guid) 
    109107                { 
    110108                    eraseUnusedMethod.Items.Remove(obj); 
  • branches/eraser6/Manager/DirectExecutor.cs

    r943 r944  
    154154                        task.Canceled = false; 
    155155                        task.OnTaskStarted(new TaskEventArgs(task)); 
    156                         OnTaskProcessing(task); 
     156                        OnTaskProcessing(new TaskEventArgs(task)); 
    157157 
    158158                        //Start a new log session to separate this session's events 
     
    161161 
    162162                        //Run the task 
    163                         TaskProgressManager progress = new TaskProgressManager(currentTask); 
     163                        TaskProgressManager progress = new TaskProgressManager(task); 
    164164                        foreach (ErasureTarget target in task.Targets) 
    165165                            try 
     
    207207                        //And the task finished event. 
    208208                        task.OnTaskFinished(new TaskEventArgs(task)); 
    209                         OnTaskProcessed(currentTask); 
     209                        OnTaskProcessed(new TaskEventArgs(task)); 
    210210                    } 
    211211 
     
    936936            //Call all the event handlers who registered to be notified of tasks 
    937937            //being added. 
    938             Owner.OnTaskAdded(item); 
     938            Owner.OnTaskAdded(new TaskEventArgs(item)); 
    939939 
    940940            //If the task is scheduled to run now, break the waiting thread and 
     
    962962 
    963963                //Call all event handlers registered to be notified of task deletions. 
    964                 Owner.OnTaskDeleted(task); 
     964                Owner.OnTaskDeleted(new TaskEventArgs(task)); 
    965965            } 
    966966        } 
  • branches/eraser6/Manager/EntropySource.cs

    r931 r944  
    164164        /// Allows plugins to register EntropySources with the main program. Thread-safe. 
    165165        /// </summary> 
    166         /// <param name="method"></param> 
     166        /// <param name="source">The source of entropy to add.</param> 
    167167        public static void Register(EntropySource source) 
    168168        { 
     
    171171                manager.sources.Add(source.Guid, source); 
    172172            manager.entropyThread.AddEntropySource(source); 
    173         } 
    174  
    175         /// <summary> 
    176         /// Performs the MethodUnregistered event handlers. 
    177         /// </summary> 
    178         /// <param name="guid">The GUID of the unregistered erasure method.</param> 
    179         private static void OnEntropySourceActivated(Guid guid) 
    180         { 
    181             if (EntropySourceActivated != null) 
    182                 EntropySourceActivated(guid); 
     173 
     174            OnEntropySourceRegistered(new EntropySourceRegistrationEventArgs(source.Guid)); 
     175        } 
     176 
     177        /// <summary> 
     178        /// Calls the EntropySourceRegistered event handlers. 
     179        /// </summary> 
     180        private static void OnEntropySourceRegistered(EntropySourceRegistrationEventArgs e) 
     181        { 
     182            if (EntropySourceRegistered != null) 
     183                EntropySourceRegistered(ManagerLibrary.Instance.EntropySourceManager, e); 
    183184        } 
    184185 
     
    193194            } 
    194195        } 
    195  
    196         /// <summary> 
    197         /// The delegate prototype of Entropy Source Registered event  
    198         /// </summary> 
    199         /// <param name="value"></param> 
    200         public delegate void OnEntropySourceActivatedEventHandler(Guid value); 
    201196 
    202197        /// <summary> 
     
    204199        /// called whenever the EntropySourceManager.Register is invoked. 
    205200        /// </summary> 
    206         public static event OnEntropySourceActivatedEventHandler EntropySourceActivated; 
     201        public static EventHandler<EntropySourceRegistrationEventArgs> 
     202            EntropySourceRegistered { get; set; } 
    207203         
    208204        /// <summary> 
     
    216212        private EntropyPoller entropyThread = new EntropyPoller(); 
    217213    }; 
     214 
     215    public class EntropySourceRegistrationEventArgs : EventArgs 
     216    { 
     217        /// <summary> 
     218        /// Constructor. 
     219        /// </summary> 
     220        /// <param name="value">The GUID of the newly registered/unregistered entropy 
     221        /// source.</param> 
     222        public EntropySourceRegistrationEventArgs(Guid value) 
     223        { 
     224            Guid = value; 
     225        } 
     226 
     227        /// <summary> 
     228        /// The GUID of the newly registered/unregistered entropy source. 
     229        /// </summary> 
     230        public Guid Guid { get; private set; } 
     231    } 
    218232         
    219233    /// <summary> 
  • branches/eraser6/Manager/Executor.cs

    r926 r944  
    9090 
    9191        /// <summary> 
    92         /// The prototype of functions handing the Task Added event. 
    93         /// </summary> 
    94         /// <param name="task">The task which has been added</param> 
    95         public delegate void TaskAddedEvent(Task task); 
    96  
    97         /// <summary> 
    9892        /// The task added event object. 
    9993        /// </summary> 
    100         public event TaskAddedEvent TaskAdded; 
     94        public EventHandler<TaskEventArgs> TaskAdded { get; set; } 
    10195 
    10296        /// <summary> 
    10397        /// Helper function for the task added event. 
    10498        /// </summary> 
    105         /// <param name="task">The task that has just been added</param> 
    106         internal void OnTaskAdded(Task task) 
     99        internal void OnTaskAdded(TaskEventArgs e) 
    107100        { 
    108101            if (TaskAdded != null) 
    109                 TaskAdded(task); 
    110         } 
    111  
    112         /// <summary> 
    113         /// The prototype of functions handing the Task Deleted event. 
    114         /// </summary> 
    115         /// <param name="task">The task which has been deleted</param> 
    116         public delegate void TaskDeletedEvent(Task task); 
     102                TaskAdded(this, e); 
     103        } 
    117104 
    118105        /// <summary> 
    119106        /// The task added event object. 
    120107        /// </summary> 
    121         public event TaskDeletedEvent TaskDeleted; 
     108        public EventHandler<TaskEventArgs> TaskDeleted { get; set; } 
    122109 
    123110        /// <summary> 
    124111        /// Helper function for the task deleted event. 
    125112        /// </summary> 
    126         /// <param name="task">The task that has just been deleted</param> 
    127         internal void OnTaskDeleted(Task task) 
     113        internal void OnTaskDeleted(TaskEventArgs e) 
    128114        { 
    129115            if (TaskDeleted != null) 
    130                 TaskDeleted(task); 
    131         } 
    132  
    133         /// <summary> 
    134         /// The delegate for handling the task processing event from the executor. 
    135         /// </summary> 
    136         /// <param name="task">The currently processing task.</param> 
    137         public delegate void TaskProcessingEvent(Task task); 
     116                TaskDeleted(this, e); 
     117        } 
    138118 
    139119        /// <summary> 
    140120        /// The task processing event object. 
    141121        /// </summary> 
    142         public event TaskProcessingEvent TaskProcessing; 
     122        public EventHandler<TaskEventArgs> TaskProcessing { get; set; } 
    143123 
    144124        /// <summary> 
    145125        /// Helper function for the Task processing event. 
    146126        /// </summary> 
    147         protected void OnTaskProcessing(Task task) 
     127        protected void OnTaskProcessing(TaskEventArgs e) 
    148128        { 
    149129            if (TaskProcessing != null) 
    150                 TaskProcessing(task); 
    151         } 
    152  
    153         /// <summary> 
    154         /// The delegate for handling the task processed event from the executor. 
    155         /// </summary> 
    156         /// <param name="task">The processed task.</param> 
    157         public delegate void TaskProcessedEvent(Task task); 
     130                TaskProcessing(this, e); 
     131        } 
    158132 
    159133        /// <summary> 
    160134        /// The task processed event object. 
    161135        /// </summary> 
    162         public event TaskProcessedEvent TaskProcessed; 
     136        public EventHandler<TaskEventArgs> TaskProcessed { get; set; } 
    163137 
    164138        /// <summary> 
    165139        /// Helper function for the Task processed event. 
    166140        /// </summary> 
    167         protected void OnTaskProcessed(Task task) 
     141        protected void OnTaskProcessed(TaskEventArgs e) 
    168142        { 
    169143            if (TaskProcessed != null) 
    170                 TaskProcessed(task); 
     144                TaskProcessed(this, e); 
    171145        } 
    172146    } 
  • branches/eraser6/Manager/Method.cs

    r938 r944  
    301301        } 
    302302 
    303         public override void Erase(Stream strm, long erasureLength, Prng prng, 
     303        public override void Erase(Stream stream, long erasureLength, Prng prng, 
    304304            ProgressFunction callback) 
    305305        { 
     
    310310 
    311311            //Remember the starting position of the stream. 
    312             long strmStart = strm.Position; 
    313             long strmLength = Math.Min(strm.Length - strmStart, erasureLength); 
     312            long strmStart = stream.Position; 
     313            long strmLength = Math.Min(stream.Length - strmStart, erasureLength); 
    314314 
    315315            //Allocate memory for a buffer holding data for the pass. 
     
    324324 
    325325                //Start from the beginning again 
    326                 strm.Seek(strmStart, SeekOrigin.Begin); 
     326                stream.Seek(strmStart, SeekOrigin.Begin); 
    327327 
    328328                //Write the buffer to disk. 
     
    343343 
    344344                    //Write the data. 
    345                     strm.Write(buffer, dataStopped, amount); 
    346                     strm.Flush(); 
     345                    stream.Write(buffer, dataStopped, amount); 
     346                    stream.Flush(); 
    347347                    toWrite -= amount; 
    348348 
     
    499499 
    500500            //Broadcast the event 
    501             OnMethodRegistered(method.Guid); 
     501            OnMethodRegistered(new ErasureMethodRegistrationEventArgs(method.Guid)); 
    502502        } 
    503503 
     
    513513 
    514514            ManagerLibrary.Instance.ErasureMethodManager.methods.Remove(value); 
    515             OnMethodUnregistered(value); 
     515            OnMethodUnregistered(new ErasureMethodRegistrationEventArgs(value)); 
    516516        } 
    517517 
     
    539539 
    540540        /// <summary> 
    541         /// The delegate prototype of the Method Registered event. 
    542         /// </summary> 
    543         /// <param name="value">The GUID of the method being registered.</param> 
    544         public delegate void MethodRegisteredFunction(Guid value); 
    545  
    546         /// <summary> 
    547541        /// Called whenever an erasure method is registered. 
    548542        /// </summary> 
    549         public static event MethodRegisteredFunction MethodRegistered; 
     543        public static EventHandler<ErasureMethodRegistrationEventArgs> 
     544            MethodRegistered { get; set; } 
    550545         
    551546        /// <summary> 
    552         /// The delegate prototype of the Method Unregistered event. 
    553         /// </summary> 
    554         /// <param name="value">The GUID of the method being registered.</param> 
    555         public delegate void MethodUnregisteredFunction(Guid value); 
    556  
    557         /// <summary> 
    558547        /// Called whenever an erasure method is unregistered. 
    559548        /// </summary> 
    560         public static event MethodUnregisteredFunction MethodUnregistered; 
     549        public static EventHandler<ErasureMethodRegistrationEventArgs> 
     550            MethodUnregistered { get; set; } 
    561551 
    562552        /// <summary> 
     
    564554        /// </summary> 
    565555        /// <param name="guid">The GUID of the newly registered erasure method.</param> 
    566         private static void OnMethodRegistered(Guid guid) 
     556        private static void OnMethodRegistered(ErasureMethodRegistrationEventArgs e) 
    567557        { 
    568558            if (MethodRegistered != null) 
    569                 MethodRegistered(guid); 
     559                MethodRegistered(ManagerLibrary.Instance.ErasureMethodManager, e); 
    570560        } 
    571561 
     
    574564        /// </summary> 
    575565        /// <param name="guid">The GUID of the unregistered erasure method.</param> 
    576         private static void OnMethodUnregistered(Guid guid) 
     566        private static void OnMethodUnregistered(ErasureMethodRegistrationEventArgs e) 
    577567        { 
    578568            if (MethodUnregistered != null) 
    579                 MethodUnregistered(guid); 
     569                MethodUnregistered(ManagerLibrary.Instance.ErasureMethodManager, e); 
    580570        } 
    581571        #endregion 
    582572    } 
     573 
     574    public class ErasureMethodRegistrationEventArgs : EventArgs 
     575    { 
     576        /// <summary> 
     577        /// Constructor. 
     578        /// </summary> 
     579        /// <param name="value">The GUID of the newly registered/unregistered 
     580        /// erasure method.</param> 
     581        public ErasureMethodRegistrationEventArgs(Guid value) 
     582        { 
     583            Guid = value; 
     584        } 
     585 
     586        /// <summary> 
     587        /// The GUID of the newly registsered/unregistered erasure method. 
     588        /// </summary> 
     589        public Guid Guid { get; private set; } 
     590    } 
    583591} 
  • branches/eraser6/Manager/RemoteExecutor.cs

    r943 r944  
    6565    /// List of supported functions 
    6666    /// </summary> 
    67     public enum RemoteExecutorFunction : uint 
     67    public enum RemoteExecutorFunction 
    6868    { 
    6969        QueueTask, 
     
    456456            //Call all the event handlers who registered to be notified of tasks 
    457457            //being added. 
    458             Owner.OnTaskAdded(item); 
     458            Owner.OnTaskAdded(new TaskEventArgs(item)); 
    459459        } 
    460460 
     
    486486 
    487487            //Call all event handlers registered to be notified of task deletions. 
    488             Owner.OnTaskDeleted(item); 
     488            Owner.OnTaskDeleted(new TaskEventArgs(item)); 
    489489            return true; 
    490490        } 
  • branches/eraser6/Manager/Task.cs

    r942 r944  
    160160        #region Events 
    161161        /// <summary> 
    162         /// The prototype for events handling just a task object as the event argument. 
    163         /// </summary> 
    164         /// <param name="e">The task object.</param> 
    165         public delegate void TaskEventFunction(TaskEventArgs e); 
    166  
    167         /// <summary> 
    168         /// The prototype for events handling the progress changed event. 
    169         /// </summary> 
    170         /// <param name="e">The new progress value.</param> 
    171         public delegate void ProgressEventFunction(TaskProgressEventArgs e); 
    172  
    173         /// <summary> 
    174162        /// The start of the execution of a task. 
    175163        /// </summary> 
    176         public event TaskEventFunction TaskStarted; 
     164        public EventHandler<TaskEventArgs> TaskStarted { get; set; } 
    177165 
    178166        /// <summary> 
    179167        /// The event object holding all event handlers. 
    180168        /// </summary> 
    181         public event ProgressEventFunction ProgressChanged; 
     169        public EventHandler<TaskProgressEventArgs> ProgressChanged { get; set; } 
    182170 
    183171        /// <summary> 
    184172        /// The completion of the execution of a task. 
    185173        /// </summary> 
    186         public event TaskEventFunction TaskFinished; 
     174        public EventHandler<TaskEventArgs> TaskFinished { get; set; } 
    187175 
    188176        /// <summary> 
     
    193181        { 
    194182            if (TaskStarted != null) 
    195                 TaskStarted(e); 
     183                TaskStarted(this, e); 
    196184            Executing = true; 
    197185        } 
     
    204192        { 
    205193            if (ProgressChanged != null) 
    206                 ProgressChanged(e); 
     194                ProgressChanged(this, e); 
    207195        } 
    208196 
     
    214202        { 
    215203            if (TaskFinished != null) 
    216                 TaskFinished(e); 
     204                TaskFinished(this, e); 
    217205            Executing = false; 
    218206        } 
     
    905893        /// Constructor. 
    906894        /// </summary> 
    907         /// <param name="task">The task being run.</param> 
     895        /// <param name="task">The task being referred to by this event.</param> 
    908896        public TaskEventArgs(Task task) 
    909897        { 
    910             this.task = task; 
     898            Task = task; 
    911899        } 
    912900 
     
    914902        /// The executing task. 
    915903        /// </summary> 
    916         public Task Task 
    917         { 
    918             get { return task; } 
    919         } 
    920  
    921         private Task task; 
     904        public Task Task { get; private set; } 
    922905    } 
    923906 
Note: See TracChangeset for help on using the changeset viewer.