/// <summary> /// Queue a work item /// </summary> /// <param name="callback">A callback to execute</param> /// <param name="state"> /// The context object of the work item. Used for passing arguments to the work item. /// </param> /// <returns>Returns a work item result</returns> public IWorkItemResult QueueWorkItem(WorkItemCallback callback, object state) { WorkItem workItem = WorkItemFactory.CreateWorkItem(this, WIGStartInfo, callback, state); Enqueue(workItem); return(workItem.GetWorkItemResult()); }
/// <summary> /// Queue a work item /// </summary> /// <param name="callback">A callback to execute</param> /// <param name="state"> /// The context object of the work item. Used for passing arguments to the work item. /// </param> /// <param name="workItemPriority">The work item priority</param> /// <returns>Returns a work item result</returns> public IWorkItemResult QueueWorkItem(WorkItemCallback callback, object state, WorkItemPriority workItemPriority) { PreQueueWorkItem(); WorkItem workItem = WorkItemFactory.CreateWorkItem(this, WIGStartInfo, callback, state, workItemPriority); Enqueue(workItem); return(workItem.GetWorkItemResult()); }
/// <summary> /// Queue a work item /// </summary> /// <param name="workItemInfo">Work item info</param> /// <param name="callback">A callback to execute</param> /// <returns>Returns a work item result</returns> public IWorkItemResult QueueWorkItem(WorkItemInfo workItemInfo, WorkItemCallback callback) { PreQueueWorkItem(); WorkItem workItem = WorkItemFactory.CreateWorkItem(this, WIGStartInfo, workItemInfo, callback); Enqueue(workItem); return(workItem.GetWorkItemResult()); }
/// <summary> /// Queue a work item /// </summary> /// <param name="callback">A callback to execute</param> /// <param name="state"> /// The context object of the work item. Used for passing arguments to the work item. /// </param> /// <param name="postExecuteWorkItemCallback"> /// A delegate to call after the callback completion /// </param> /// <returns>Returns a work item result</returns> public IWorkItemResult QueueWorkItem( WorkItemCallback callback, object state, PostExecuteWorkItemCallback postExecuteWorkItemCallback) { PreQueueWorkItem(); WorkItem workItem = WorkItemFactory.CreateWorkItem(this, WIGStartInfo, callback, state, postExecuteWorkItemCallback); Enqueue(workItem); return(workItem.GetWorkItemResult()); }
public IWorkItemResult <TResult> QueueWorkItem <TResult>(Func <TResult> func) { PreQueueWorkItem(); WorkItem workItem = WorkItemFactory.CreateWorkItem( this, WIGStartInfo, state => { return(func.Invoke()); }); Enqueue(workItem); return(new WorkItemResultTWrapper <TResult>(workItem.GetWorkItemResult())); }
public IWorkItemResult <TResult> QueueWorkItem <T1, T2, TResult>(Func <T1, T2, TResult> func, T1 arg1, T2 arg2) { PreQueueWorkItem(); WorkItem workItem = WorkItemFactory.CreateWorkItem( this, WIGStartInfo, state => { return(func.Invoke(arg1, arg2)); }, WIGStartInfo.FillStateWithArgs ? new object[] { arg1, arg2 } : null); Enqueue(workItem); return(new WorkItemResultTWrapper <TResult>(workItem.GetWorkItemResult())); }
public IWorkItemResult QueueWorkItem(Action action, WorkItemPriority priority) { PreQueueWorkItem(); WorkItem workItem = WorkItemFactory.CreateWorkItem( this, WIGStartInfo, delegate { action.Invoke(); return(null); }, priority); Enqueue(workItem); return(workItem.GetWorkItemResult()); }
public IWorkItemResult QueueWorkItem <T1, T2, T3> (Action <T1, T2, T3> action, T1 arg1, T2 arg2, T3 arg3, WorkItemPriority priority) { PreQueueWorkItem(); WorkItem workItem = WorkItemFactory.CreateWorkItem( this, WIGStartInfo, state => { action.Invoke(arg1, arg2, arg3); return(null); }, WIGStartInfo.FillStateWithArgs ? new object[] { arg1, arg2, arg3 } : null, priority); Enqueue(workItem); return(workItem.GetWorkItemResult()); }