Exemplo n.º 1
0
        public static void Execute(DatabaseManager dbMgr, string[] args)
        {
            //---- Hook up the assembly loading ----
            AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve);
            AppDomain.CurrentDomain.TypeResolve     += new ResolveEventHandler(CurrentDomain_TypeResolve);

            assemblyLoader = new KernelAssemblyLoader();
            assemblyLoader.DatabaseManager = dbMgr;

            kernelEnvironment.Register(
                new Instance(assemblyLoader, "AssemblyLoader"));

            kernelEnvironment.Register(
                new ConfiguredComponent(
                    typeof(DocumentManagement), "DocumentManagement"));

            kernelEnvironment.Register(
                new ConfiguredComponent(
                    typeof(KernelApplicationsDirectory), "ApplicationManagement"));

            kernelEnvironment.Register(
                new ConfiguredComponent(
                    typeof(Installation.AuthoringInstallationService), "InstallationService"));

            kernelEnvironment.Register(
                new Instance(dbMgr, "DatabaseManagerDriver"));

            kernelEnvironment.Register(
                new AlwaysNewConfiguredComponent(typeof(DatabaseManager), "DatabaseManager"));

            kernelEnvironment.Register(
                new ConfiguredComponent(typeof(StandardConsole), "Console"));

            kernelEnvironment.Register(
                new ConfiguredComponent(typeof(ServiceManager), "Services"));
            kernelEnvironment.GetInstance<IServiceRegistry>();

            kernelEnvironment.Register(
                new ConfiguredComponent(typeof(ThreadControl), "ThreadControl"));

            //---- INIT ----
            InstallationService installService = kernelEnvironment.GetInstance<InstallationService>();

            if (!installService.IsPackageInstalled(baseSystemId))
            {
                IPackage pkg = 
                    installService.OpenPackageForInstallation("/Volumes/Host/Installation/BaseSystem.ipkg");

                pkg.Selected = true;
                installService.Install(pkg);
     
                pkg =
                    installService.OpenPackageForInstallation("/Volumes/Host/Installation/Graphics.ipkg");
                
                pkg.Selected = true;
                installService.Install(pkg);

                
                pkg =
                    installService.OpenPackageForInstallation("/Volumes/Host/Installation/Direct3D10Driver.ipkg");

                pkg.Selected = true;
                installService.Install(pkg);
                 
                /*
                pkg = 
                    installService.OpenPackageForInstallation("/Volumes/Host/Installation/Tools.ipkg");
                pkg.Selected = true;
                installService.Install(pkg);*/
            }

            IApplicationInstances appInstances = kernelEnvironment.GetInstance<IApplicationInstances>();
            IApplicationInstance init = appInstances.Run("/System/Applications/Components/Init", string.Empty, args);

            while (init.IsRunning) Thread.Sleep(100);
        }