示例#1
0
        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);
        }
示例#2
0
        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);
        }
示例#3
0
 public NoomRouterEntry(NoomRouterPath path, Func <IRequest, Task <IViewFactory> > handler)
 {
     this.path    = path;
     this.handler = handler;
 }