예제 #1
0
        /// <summary>
        /// Invoked when a step is accessed on the url,
        /// i.e. http://host/mywizard/firststep.rails and
        /// when an inner action is invoked like http://host/mywizard/firststep-save.rails
        /// </summary>
        /// <param name="controller"></param>
        private void OnStepActionRequested(Controller controller)
        {
            controller.CancelView();

            IRailsEngineContext context = controller.Context;

            IWizardController wizController = (IWizardController)controller;

            String wizardName = WizardUtils.ConstructWizardNamespace(controller);

            String currentStep = (String)context.Session[wizardName + "currentstep"];

            // The step will inherit the controller property bag,
            // this way filters can pass values to the step property without having to know it
            currentStepInstance.PropertyBag = controller.PropertyBag;

            if (!wizController.OnBeforeStep(wizardName, currentStep, currentStepInstance))
            {
                return;
            }

            WizardUtils.RegisterCurrentStepInfo(controller, currentStepInstance.ActionName);

            if (innerAction == null || innerAction == String.Empty)
            {
                currentStepInstance.Process(
                    controller.Context, controller.ServiceProvider,
                    urlInfo.Area, urlInfo.Controller, "RenderWizardView");
            }
            else
            {
                currentStepInstance.Process(
                    controller.Context, controller.ServiceProvider,
                    urlInfo.Area, urlInfo.Controller, innerAction);
            }

            wizController.OnAfterStep(wizardName, currentStep, currentStepInstance);
        }