public void RegisterAsync(string path, Func <IRequest, Task <IViewFactory> > handler) { NoomRouterPath key = new NoomRouterPath(path); NoomRouterEntry entry = new NoomRouterEntry(key, handler); items.Add(key, entry); }
public void Register(string path, Func <IRequest, IViewFactory> handler) { Func <IRequest, Task <IViewFactory> > callback = request => { TaskCompletionSource <IViewFactory> result = new TaskCompletionSource <IViewFactory>(); IViewFactory view = handler.Invoke(request); result.SetResult(view); return(result.Task); }; NoomRouterPath key = new NoomRouterPath(path); NoomRouterEntry entry = new NoomRouterEntry(key, callback); items.Add(key, entry); }
public NoomRouterEntry(NoomRouterPath path, Func <IRequest, Task <IViewFactory> > handler) { this.path = path; this.handler = handler; }