public static IExportRegistrationBlock WithCommon(this IExportRegistrationBlock block,
                                                          WindowsDeploymentOptionsProvider installOptionsProvider)
        {
            var taskTypes = from a in Assemblies.AppDomainAssemblies
                            from type in a.ExportedTypes
                            where type.GetTypeInfo().ImplementedInterfaces.Contains(typeof(IDeploymentTask))
                            select type;

            block.ExportAssemblies(Assemblies.AppDomainAssemblies).ByInterface <ISpaceAllocator <IDevice> >();
            block.Export <ZipExtractor>().As <IZipExtractor>();
            block.ExportFactory(Tokenizer.Create).As <Tokenizer <LangToken> >();
            block.Export <ScriptParser>().As <IScriptParser>();
            block.ExportFactory(() => installOptionsProvider).As <IWindowsOptionsProvider>();
            block.Export <WoaDeployer>().As <IWoaDeployer>();
            block.Export <BootCreator>().As <IBootCreator>();
            block.Export <LowLevelApi>().As <ILowLevelApi>();
            block.ExportInstance(taskTypes).As <IEnumerable <Type> >();
            block.Export <ScriptRunner>().As <IScriptRunner>();
            block.Export <InstanceBuilder>().As <IInstanceBuilder>();
            block.Export <RaspberryPathBuilder>().As <IPathBuilder>();
            block.Export <FileSystemOperations>().As <IFileSystemOperations>();
            block.Export <BcdInvokerFactory>().As <IBcdInvokerFactory>();
            block.Export <WindowsDeployer>().As <IWindowsDeployer>();
            block.Export <RaspberryDisklayoutPreparer>().As <IDiskLayoutPreparer>();
            block.Export <ImageFlasher>().As <IImageFlasher>();
            block.Export <DismImageService>().As <IWindowsImageService>();

            block.ExportFactory(() => AzureDevOpsClient.Create(new Uri("https://dev.azure.com"))).As <IAzureDevOpsBuildClient>();

            return(block);
        }
Example #2
0
 public void Configure(IExportRegistrationBlock block)
 {
     block.ExportAssemblies(new[] { typeof(MainViewModel).Assembly })
     .Where(y => typeof(ISection).IsAssignableFrom(y))
     .ByInterface <ISection>()
     .ByInterface <IBusy>()
     .ByType()
     .ExportAttributedTypes()
     .Lifestyle.Singleton();
 }
        public static IExportRegistrationBlock Configure(this IExportRegistrationBlock block)
        {
            var taskTypes = from a in Assemblies.AppDomainAssemblies
                            from type in a.ExportedTypes
                            where type.GetTypeInfo().ImplementedInterfaces.Contains(typeof(IDeploymentTask))
                            select type;

            block.ExportAssemblies(Assemblies.AppDomainAssemblies).ByInterface <ISpaceAllocator <IPhone> >().Lifestyle.Singleton();
            block.ExportAssemblies(Assemblies.AppDomainAssemblies).BasedOn <LumiaDiskLayoutPreparer>().ByInterface <IDiskLayoutPreparer>().ExportAttributedTypes().Lifestyle.Singleton();
            block.Export <ZipExtractor>().As <IZipExtractor>();
            block.ExportFactory(Tokenizer.Create).As <Tokenizer <LangToken> >().Lifestyle.Singleton();
            block.Export <ScriptParser>().As <IScriptParser>().Lifestyle.Singleton();
            block.Export <PhoneInfoReader>().As <IPhoneInfoReader>().Lifestyle.Singleton();
            block.Export <WoaDeployer>().As <IWoaDeployer>().Lifestyle.Singleton();
            block.Export <Tooling>().As <ITooling>().Lifestyle.Singleton();
            block.Export <BootCreator>().As <IBootCreator>().Lifestyle.Singleton();
            block.Export <DiskApi>().As <IDiskApi>().Lifestyle.Singleton();
            block.Export <PhonePathBuilder>().As <IPathBuilder>().Lifestyle.Singleton();
            block.ExportInstance(taskTypes).As <IEnumerable <Type> >();
            block.Export <ScriptRunner>().As <IScriptRunner>().Lifestyle.Singleton();
            block.Export <InstanceBuilder>().As <IInstanceBuilder>().Lifestyle.Singleton();
            block.Export <FileSystemOperations>().As <IFileSystemOperations>().Lifestyle.Singleton();
            block.Export <BcdInvokerFactory>().As <IBcdInvokerFactory>().Lifestyle.Singleton();
            block.Export <WindowsDeployer>().As <IWindowsDeployer>().Lifestyle.Singleton();
            block.ExportFactory(() => new HttpClient {
                Timeout = TimeSpan.FromMinutes(30)
            }).Lifestyle.Singleton();
            block.ExportFactory(() => new GitHubClient(new ProductHeaderValue("WOADeployer"))).As <IGitHubClient>().Lifestyle.Singleton();
            block.Export <Downloader>().As <IDownloader>().Lifestyle.Singleton();
            block.Export <ExistingDeploymentCleaner>().As <IExistingDeploymentCleaner>().Lifestyle.Singleton();
            block.ExportFactory((IPhone phone) => new DeploymentContext {
                Device = phone
            }).As <IDeploymentContext>().Lifestyle.Singleton();
            block.Export <OperationContext>().As <IOperationContext>().Lifestyle.Singleton();
            block.ExportFactory(() => AzureDevOpsBuildClient.Create(new Uri("https://dev.azure.com"))).As <IAzureDevOpsBuildClient>().Lifestyle.Singleton();
            block.Export <PhoneModelInfoInfoReader>().As <IPhoneModelInfoReader>().Lifestyle.Singleton();
            block.Export <Phone>().As <IPhone>().Lifestyle.Singleton();
            block.Export <DismImageService>().As <IWindowsImageService>().Lifestyle.Singleton();
            block.Export <LogCollector>().As <ILogCollector>().Lifestyle.Singleton();

            return(block);
        }
Example #4
0
        public void Configure(IExportRegistrationBlock block)
        {
            block.Export <GuiRequirementSatisfier>().As <IRequirementSatisfier>().Lifestyle.Singleton();
            block.Export <WpfDialogService>().As <IDialogService>().Lifestyle.Singleton();
            block.Export <SettingsService>().As <ISettingsService>().Lifestyle.Singleton();
            block.Export <OpenFilePicker>().As <IOpenFilePicker>().Lifestyle.Singleton();
            block.Export <DesktopFilePicker>().As <IFilePicker>().Lifestyle.Singleton();
            block.ExportFactory <Uri, IFileSystemOperations, ZafiroFile>((uri, f) => new DesktopZafiroFile(uri, f, null));
            block.Export <MarkdownService>().As <IMarkdownService>().Lifestyle.Singleton();
            var simpleInteraction = new SimpleInteraction();

            simpleInteraction.Register("Requirements", typeof(Requirements));
            block.ExportInstance(simpleInteraction).As <ISimpleInteraction>();
            block.Export <ScriptDeployer>().As <Core.Deployer>().Lifestyle.Singleton();
            block.Export <DeviceDeployer>().As <Core.Deployer>().Lifestyle.Singleton();
            block.ExportAssemblies(Assemblies.AppDomainAssemblies)
            .Where(y => typeof(ISection).IsAssignableFrom(y))
            .ByInterface <ISection>()
            .ByInterface <IBusy>()
            .ByType()
            .ExportAttributedTypes()
            .Lifestyle.Singleton();
        }