Exemplo n.º 1
0
        /// <summary>
        /// This method loads the Profile Catalog Modules by calling GetModuleInfoStore which, unless overridden, uses a DefaultModuleInfoStore instance.
        /// It then creates an instance of TShell and calls Application.Run with that instance.
        /// </summary>
        public void Start()
        {
            // load up the profile catalog here
            IModuleInfoStore store = GetModuleInfoStore();

            Start(store);
        }
Exemplo n.º 2
0
        public override void Start(IModuleInfoStore store)
        {
#if DESKTOP
            if (IsSingletonApp)
            {
                if (HandleSingleton())
                {
                    return;
                }
            }
#endif

            // add a generic "control" to the Items list.
            var invoker = new Control();
            // force handle creation
            var handle = invoker.Handle;
            RootWorkItem.Items.Add(invoker, Constants.EventInvokerName);
            ModuleInfoStoreService storeService = RootWorkItem.Services.AddNew <ModuleInfoStoreService>();

            AddServices();

            if (store != null)
            {
                storeService.ModuleLoaded += new EventHandler <GenericEventArgs <IModuleInfo> >(OnModuleLoaded);
                storeService.LoadModulesFromStore(store);
            }

            BeforeShellCreated();

            // create the shell form after all modules are loaded
            // see if there's a registered shell replacement.
            ShellReplacement replacement = null;

            if (EnableShellReplacement)
            {
                replacement = RootWorkItem.Services.Get <ShellReplacement>();
            }

            if ((replacement == null) || (!replacement.ShellReplacementEnabled))
            {
                ShellForm = RootWorkItem.Items.AddNew <TShell>();
            }
            else
            {
                ShellForm = replacement as Form;
                Trace.WriteLine("Replacement shell found.", Constants.TraceCategoryName);
            }

            AfterShellCreated();

            OnApplicationRun(ShellForm);

            OnApplicationClose();
        }
Exemplo n.º 3
0
        public virtual void Start(IModuleInfoStore store)
        {
            ModuleInfoStoreService storeService = RootWorkItem.Services.AddNew <ModuleInfoStoreService>();

            AddServices();

            if (store != null)
            {
                storeService.ModuleLoaded += new EventHandler <GenericEventArgs <IModuleInfo> >(OnModuleLoaded);
                storeService.LoadModulesFromStore(store);
            }

            OnApplicationRun();
        }
        public void LoadModulesFromStore(IModuleInfoStore store)
        {
            Validate
            .Begin()
            .IsNotNull(store, "store")
            .Check();

            // load modules from XML
            string xml = store.GetModuleListXml();

            if (xml != null)
            {
                XmlReaderSettings settings = new XmlReaderSettings();
                settings.ConformanceLevel = ConformanceLevel.Document;
                settings.IgnoreWhitespace = true;
                settings.IgnoreComments   = true;

                var assemblyNames = GetAssembliesFromXml(xml);

                // load each assembly
                LoadAssemblies(assemblyNames);
            }

            // now let the IModuleInfoStore directly load assemblies and pass them back
            var assemblies = store.GetModuleAssemblies();

            if (assemblies != null)
            {
                foreach (var assembly in assemblies)
                {
                    LoadAssembly(assembly);
                }
            }

            // now notify all assemblies that all other assemblies are loaded (this is useful when there are module interdependencies
            NotifyAssembliesOfContainerCompletion();
        }
 public WebModuleEnumerator([ServiceDependency] IModuleInfoStore store)
 {
     _store = store;
 }
 public WebModuleEnumerator([ServiceDependency] IModuleInfoStore store)
 {
     _store = store;
 }