/// <summary> /// Queue a work item. /// </summary> /// <returns>Returns a IWorkItemResult object, but its GetResult() will always return null</returns> /// <param name="action">Action.</param> /// <param name="arg1">Arg1.</param> /// <param name="arg2">Arg2.</param> /// <param name="arg3">Arg3.</param> /// <param name="arg4">Arg4.</param> /// <param name="priority">Priority.</param> /// <typeparam name="T1">The 1st type parameter.</typeparam> /// <typeparam name="T2">The 2nd type parameter.</typeparam> /// <typeparam name="T3">The 3rd type parameter.</typeparam> /// <typeparam name="T4">The 4th type parameter.</typeparam> public IWorkItemResult QueueWorkItem <T1, T2, T3, T4> (Common.Threading.Action <T1, T2, T3, T4> action, T1 arg1, T2 arg2, T3 arg3, T4 arg4, WorkItemPriority priority) { PreQueueWorkItem(); WorkItem workItem = WorkItemFactory.CreateWorkItem( this, WIGStartInfo, state => { action.Invoke(arg1, arg2, arg3, arg4); return(null); }, WIGStartInfo.FillStateWithArgs ? new object[] { arg1, arg2, arg3, arg4 } : null, priority); Enqueue(workItem); return(workItem.GetWorkItemResult()); }
/// <summary> /// Queue a work item /// </summary> /// <param name="action">Action.</param> /// <param name="arg">Argument.</param> /// <param name="priority">Priority.</param> /// <typeparam name="T">The 1st type parameter.</typeparam> public IWorkItemResult QueueWorkItem <T> (Action <T> action, T arg, WorkItemPriority priority) { PreQueueWorkItem(); WorkItem workItem = WorkItemFactory.CreateWorkItem( this, WIGStartInfo, state => { action.Invoke(arg); return(null); }, WIGStartInfo.FillStateWithArgs ? new object[] { arg } : null, priority); Enqueue(workItem); return(workItem.GetWorkItemResult()); }