Beispiel #1
0
        /// <summary>
        /// Creates the controller for the view.
        /// </summary>
        /// <param name="view">The name of the view in the Views section of the configuration file.</param>
        /// <param name="navigator">The navigator that the controller uses for navigation services.</param>
        /// <returns></returns>
        public static ControllerBase Create(String view, Navigator navigator)
        {
            String viewName = getViewName(view);
            ControllerSettings typeSettings = UIPConfiguration.Config.GetControllerSettings(viewName);
            if (typeSettings == null)
                throw new Exception(string.Format("ExceptionControllerNotFound: {0}.", viewName));

            return createController(typeSettings, navigator);
        }
Beispiel #2
0
        public static ControllerBase CreateByName(String controllerName, Navigator navigator)
        {
            ControllerSettings typeSettings =
                UIPConfiguration.Config.GetControllersSettingsFromName(controllerName);

            if (typeSettings == null)
                throw new Exception(string.Format("ExceptionControllerNotFound: {0}.", controllerName));

            return createController(typeSettings, navigator);
        }
Beispiel #3
0
        private static ControllerBase createController(ControllerSettings typeSettings, Navigator navigator)
        {
            IControllerActionsInterceptor interceptor = null;
            if (!String.IsNullOrEmpty(typeSettings.Interceptor))
            {
                ObjectTypeSettings typeInterceptor = (ObjectTypeSettings)UIPConfiguration.Config.InterceptorCollection[typeSettings.Interceptor];
                interceptor = (IControllerActionsInterceptor)
                    GenericFactory.Create(typeInterceptor);
            }
            else
            {
                interceptor = new ControllerActionsInterceptor();
            }

            interceptor.State = navigator.CurrentState;
            interceptor.MapPropsStateKeys = typeSettings.MapPropsKeys;

            Type typeController = GenericFactory.CreateTypeInstance(typeSettings);
            Debug.Assert(typeController != null);

            return (ControllerBase) proxyGenerator.CreateClassProxy(
                                                    typeController, new IInterceptor[] {interceptor},
                                                    new object[] {navigator});
        }
Beispiel #4
0
 /// <summary>
 /// Creates a controller.
 /// </summary>
 /// <param name="navigator">Provides navigation services for the controller.</param>
 protected ControllerBase(Navigator navigator)
 {
     _navigator = navigator;
 }
Beispiel #5
0
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            _sessionMoniker = GetSessionMoniker();
            _navigator = GetNavigator(_sessionMoniker.NavGraphName, _sessionMoniker.TaskId);
        }
Beispiel #6
0
 /// <summary>
 /// Activates a specific view.
 /// </summary>
 /// <param name="previousView">The view actually displayed.</param>		
 /// <param name="view">The name of the view to be displayed.</param>
 /// <param name="navigator">The navigator requesting the transition.</param>		
 public virtual void ActivateView(string previousView, string view, Navigator navigator)
 {
     ActivateView(previousView, navigator.CurrentState.TaskId, navigator.Name, view);
 }
Beispiel #7
0
 /// <summary>
 /// Activates a specific view.
 /// </summary>
 /// <param name="previousView">The view actually displayed.</param>		
 /// <param name="view">The name of the view to be displayed.</param>
 /// <param name="navigator">The navigator requesting the transition.</param>
 /// <param name="args">Not used in this implementation of ActivateView.</param>
 public void ActivateView(string previousView, string view, Navigator navigator, TaskArgumentsHolder args)
 {
     ActivateView(previousView, view, navigator);
 }