示例#1
0
        /// <summary>
        /// Configure the module catalogs.
        /// Extracts all navigation settings for all modules.
        /// </summary>
        protected override void ConfigureModuleCatalog()
        {
            // Dynamic Modules are copied to a directory as part of a post-build step.
            // These modules are not referenced in the startup project and are discovered
            // by examining the assemblies in a directory. The module projects have the
            // following post-build step in order to copy themselves into that directory:
            //
            // xcopy "$(TargetDir)$(TargetFileName)" "$(TargetDir)modules\" /y
            //
            // WARNING! Do not forget to explicitly compile the solution before each running
            // so the modules are copied into the modules folder.
            var directoryCatalog = (DirectoryModuleCatalog)ModuleCatalog;

            directoryCatalog.Initialize();

            _navigationLinkService = new NavigationLinkService();
            var typeFilter = new TypeFilter(InterfaceFilter);

            // First - add executing module naviagtion
            _navigationLinkService.NavigationLinkGroups.Add(new NavigationLinksGroup());

            foreach (var module in directoryCatalog.Items)
            {
                var moduleInfo = (ModuleInfo)module;
                var assembly   = Assembly.LoadFrom(moduleInfo.Ref);

                foreach (Type t in assembly.GetTypes())
                {
                    var navigationInterfaces = t.FindInterfaces(typeFilter, typeof(INavigationLinksGroup).ToString());

                    if (navigationInterfaces.Length > 0)
                    {
                        // Get all links (menus) for a module
                        var navigationLinksGroup = (INavigationLinksGroup)assembly.CreateInstance(t.FullName);
                        _navigationLinkService.NavigationLinkGroups.Add(navigationLinksGroup);
                    }
                }
            }

            // Use this to add local module if available
            //  var moduleCatalog = (ModuleCatalog)ModuleCatalog;
            //  moduleCatalog.AddModule(typeof(Local Module ));
        }
示例#2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ShellViewModel"/> class.
 /// </summary>
 /// <param name="navigationLinkService">The navigation service.</param>
 public ShellViewModel(INavigationLinkService navigationLinkService)
 {
     MenuLinkGroups   = navigationLinkService.LinkGroupCollection;
     ContentSourceUrl = navigationLinkService.StartSoureUrl;
 }
示例#3
0
 public NavigationLinkController(INavigationLinkService NavigationLinkService)
 {
     _NavigationLinkService = NavigationLinkService;
 }