예제 #1
0
        /// <summary>
        /// Handles the TaskCompleted event of the <see cref="Job"/>.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="Digipede.Framework.Api.TaskStatusEventArgs"/> instance containing the event data.</param>
        private static void job_TaskCompleted(object sender, TaskStatusEventArgs e)
        {
            PhyloDWorker worker = (PhyloDWorker)e.TaskResult.Worker;

            using (StreamWriter writer = new StreamWriter(worker.LocalOutputFileName)) {
                writer.Write(worker.OutputData);
            }
            Console.WriteLine("Wrote the result of task {0} to output file '{1}'.", e.TaskId, worker.OutputFileName);
        }
예제 #2
0
        /// <summary>
        /// raises the SyncNotify and then the AsyncNotify evnts in that order
        /// </summary>
        /// <param name="args"></param>
        protected virtual void Notify(TaskStatusEventArgs args)
        {
            //raise the syncNotify on the same thread as the caller of the Notify()
            if (this.SyncNotify != null)
            {
                this.SyncNotify(this, args);
            }

            //use the PostOrSend to raise the asyncNotify event on the thread that
            //is defined as using the synContext that is passed into the Task ctor
            if (this.asyncNotify != null)
            {
                this.PostOrSend(true, asyncNotify, new object[] { this, args });
            }
        }
예제 #3
0
 private void StatusHandler(object sender, TaskStatusEventArgs e)
 {
     var status = e.Status;
 }