//calls all the dots private void GetSpecificDots(DotTask callback) { foreach (var d in grid.allDots) { callback(d); } }
//calls the dots with said column number private void GetSpecificDots(int column, DotTask callback) { foreach (var d in grid.allDots) { if (d.ColumnNumber == column) { callback(d); } } }
public static PromiseTaskResultHandle <TOut> Build <TIn, TOut>(this DotqApi dotqApi, DotTask <TIn, TOut> task, Action <TOut> onResolve = null) { var handle = new PromiseTaskResultHandle <TOut>(task, onResolve); return(handle); }
public static ITaskResultHandle <TOut> Delay2 <TOut, TIn>(this DotqApi dotqApi, DotTask <TIn, TOut> task) { dotqApi._taskQueue.Enqueue(task); return(new PromiseTaskResultHandle <TOut>(task, dotqApi._redis)); }
/// <summary> /// First creates promise and wraps it with a taskResultHandle. /// Then starts to listen for promise to resolve. /// Then enqueues task for a worker to execute task and resolve the promise. /// </summary> /// <param name="dotqApi"></param> /// <param name="task"></param> /// <typeparam name="TIn"></typeparam> /// <typeparam name="TOut"></typeparam> /// <returns></returns> public static ITaskResultHandle <TOut> Delay <TIn, TOut>(this DotqApi dotqApi, DotTask <TIn, TOut> task) // this method is written as extension method since I do not want DotqApi to be a generic class. It should be concrete { var handle = new PromiseTaskResultHandle <TOut>(task); handle.Listen(dotqApi._redisPromiseClient); dotqApi._taskQueue.Enqueue(task); return(handle); }