Exemple #1
0
 /// <summary>
 /// The job of this method is invoke an action and ultimately populate the 
 /// </summary>
 /// <param name="application">The current application</param>
 /// <param name="context">A context which stores the request and response contexts.</param>
 public async Task Execute(MvcApplication application, NavigationContext context)
 {
     Initialize(application, context);
     var action = RouteData.Action;
     var actionResult = await ActionInvoker.InvokeAction(ControllerContext, action);
     var view = ((ViewResult)actionResult).View;
     view.Initialize(application.CreateViewContext(this));
     context.Response.View = view;
 }
Exemple #2
0
        private NavigationContext CreateNavigationContext(string path, string queryString)
        {
            // Create http context
            var queryStringDictionary = new Dictionary<string, string>();
            if (queryString != null)
            {
                var parts = queryString.Split(new[] { '&' });
                foreach (var part in parts)
                {
                    var pair = part.Split(new[] { '=' });
                    var key = HttpUtility.UrlDecode(pair[0]);
                    var value = HttpUtility.UrlDecode(pair[1]);
                    queryStringDictionary[key] = value;
                }
            }
            var routeData = routeTree.Apply(path, "GET");
            var request = new NavigationRequest
            {
                Path = path,
                QueryString = queryStringDictionary,
                RouteData = routeData
            };
            var response = new NavigationResponse();

            var navigationContext = new NavigationContext
            {
                Request = request,
                Response = response
            };

            return navigationContext;
        }
Exemple #3
0
 public override void ExecuteResult(NavigationContext context)
 {
 }
Exemple #4
0
 protected virtual void Initialize(MvcApplication application, NavigationContext requestContext)
 {
     NavigationContext = requestContext;
     ActionInvoker = new ControllerActionInvoker();
     ControllerContext = new ControllerContext { Application = application, NavigationContext = NavigationContext, Controller = this };
 }