Ejemplo n.º 1
0
        /// <summary>
        /// Instantiates a new instance of the ModuleManager class. During instantiation  
        /// the <see cref="ModulesNavigationView"/> is registered with Unity and loaded 
        /// using Prism. 
        /// </summary>
        /// <param name="container">The unity container which is used to register the <see cref="ModulesNavigationView"/> class.</param>
        /// <param name="navigationManager">Loads the <see cref="ModulesNavigationView"/> class using Prism.</param>
        public ModuleNavigator(IUnityContainer container, NavigationManager navigationManager)
        {
            this.container = container;
            this.navigationManager = navigationManager;

            //  UNITY
            //  1. When a class is resolving from Unity as System.Object types to get it to resolve to the correct
            //     type map Unity's native System.Object resolution to the correct type for the class requested.
            // 
            //  2. Include an instance of the ContainerControlledLifetimeManager class in the parameters
            //     to the RegisterType method to instruct the container to register a singleton mapping.
            container.RegisterType<object, ModulesNavigationView>(typeof(ModulesNavigationView).Name,
                new ContainerControlledLifetimeManager());

            navigationManager.NavigateNavigationRegion(typeof(ModulesNavigationView).Name);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Instantiates a new instance of the ModuleManager class. During instantiation
        /// the <see cref="ModulesNavigationView"/> is registered with Unity and loaded
        /// using Prism.
        /// </summary>
        /// <param name="container">The unity container which is used to register the <see cref="ModulesNavigationView"/> class.</param>
        /// <param name="navigationManager">Loads the <see cref="ModulesNavigationView"/> class using Prism.</param>
        public ModuleNavigator(IUnityContainer container, NavigationManager navigationManager)
        {
            this.container         = container;
            this.navigationManager = navigationManager;

            //  UNITY
            //  1. When a class is resolving from Unity as System.Object types to get it to resolve to the correct
            //     type map Unity's native System.Object resolution to the correct type for the class requested.
            //
            //  2. Include an instance of the ContainerControlledLifetimeManager class in the parameters
            //     to the RegisterType method to instruct the container to register a singleton mapping.
            container.RegisterType <object, ModulesNavigationView>(typeof(ModulesNavigationView).Name,
                                                                   new ContainerControlledLifetimeManager());

            navigationManager.NavigateNavigationRegion(typeof(ModulesNavigationView).Name);
        }