TaskCompletedEventArgs Class

Provides data for the TaskCompleted event.
Inheritance Hierarchy
SystemObject
  SystemEventArgs
    AGI.Parallel.ClientTaskCompletedEventArgs
Namespace:  AGI.Parallel.Client
Assembly:  AGI.Parallel.Client (in AGI.Parallel.Client.dll) Version: 1.4.0.476 (1.4.0.476)
Syntax
public sealed class TaskCompletedEventArgs : EventArgs

The TaskCompletedEventArgs type exposes the following members.

Properties
  Name Description
Public property Task
Gets the task that completed.
Top
Methods
  Name Description
Public method Equals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Protected method Finalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public method GetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public method GetType
Gets the Type of the current instance.
(Inherited from Object.)
Protected method MemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public method ToString
Returns a string that represents the current object.
(Inherited from Object.)
Top
Examples
using System;
using AGI.Parallel.Client;
using AGI.Parallel.Infrastructure;

namespace CodeSamples
{
    class Program
    {
        static void Main(string[] args)
        {
            using (IJobScheduler scheduler = new ClusterJobScheduler("localhost"))
            {
                scheduler.Connect();

                // Method 1. Use the TaskCompleted property on the job.
                Job job = scheduler.CreateJob();
                job.AddTask(new OurTask());
                job.TaskCompleted += new EventHandler<TaskCompletedEventArgs>(OnTaskCompleted);
                job.Submit();
                job.WaitUntilDone();
            }


            using (IJobScheduler scheduler = new ClusterJobScheduler("localhost"))
            {
                scheduler.Connect();

                // Method 2. Use the Completed property on the task.
                Job job = scheduler.CreateJob();
                Task task = new OurTask();
                task.Completed += new EventHandler<EventArgs>(OnCompleted);
                job.AddTask(task);
                job.Submit();
                job.WaitUntilDone();
            }
        }

        private static void OnTaskCompleted(object sender, TaskCompletedEventArgs e)
        {
            // You could process the results here.
            Console.WriteLine("Task finished...");
            Console.WriteLine(e.Task.TaskStatus);
            Console.WriteLine(e.Task.Result);
        }

        private static void OnCompleted(object sender, EventArgs e)
        {
            // You could process the results here.
            Console.WriteLine("Task finished...");
            Task task = (Task)sender;
            Console.WriteLine(task.TaskStatus);
            Console.WriteLine(task.Result);
        }
    }

    [Serializable]
    class OurTask : Task
    {
        public override void Execute()
        {
        }
    }
}
See Also

STK Scalability 1.4 API for .NET