/// <summary> /// Completes this task. The delegate MUST call this method to complete the task. /// </summary> /// <param name="exception">The exception for the task.</param> /// <param name="actionResult">The task result for the task. Can include the exception.</param> /// <remarks>The signature includes exception since Complete(null) cannot be disambiguated otherwise. /// If the exception given is not null, then it will be stored in the task result as well. /// </remarks> public void Complete(Exception exception, AsyncTaskResult actionResult) { lock (m_syncRoot) { if (m_isCompleted) { if (s_isLoggingOn && this.Logger != null) { this.Logger.Log(Logger.LogLevel.Warning, String.Format("Task is completing more than once. Task = {0}", this.Name)); } return; } m_isCompleted = true; } EventHandler <AsyncTaskCompletedEventArgs> taskCompletedEventHandler = this.TaskCompleted; m_actionResult = actionResult; if (m_actionResult == null) { m_actionResult = new AsyncTaskResult(exception); } if (exception != null) { m_actionResult.Exception = exception; } if (taskCompletedEventHandler != null) { AsyncTaskCompletedEventArgs taskCompletedEventArgs = new AsyncTaskCompletedEventArgs(m_actionResult); taskCompletedEventHandler(this, taskCompletedEventArgs); } if (s_isLoggingOn && this.Logger != null) { this.Logger.Log(Logger.LogLevel.Info, "Completing <" + this.Name + ">"); } }
void getUserEndpointTask_TaskCompleted(object sender, AsyncTaskCompletedEventArgs e) { throw new NotImplementedException(); }