/// <inheritdoc /> protected override void Load(ContainerBuilder builder) { // Create a default configuration, if none exists builder.Register(context => IniFileConfigBuilder.Create().BuildIniFileConfig()) .IfNotRegistered(typeof(IniFileConfig)) .As <IniFileConfig>() .SingleInstance(); builder.RegisterType <ResourceManager>() .AsSelf() .SingleInstance(); builder.RegisterType <IniFileContainer>() .AsSelf() .SingleInstance(); builder.RegisterType <ConfigurationService>() .As <IService>() .SingleInstance(); builder .Register(c => IniSection <IUiConfiguration> .Create()) .As <IUiConfiguration>() .As <IIniSection>() .SingleInstance(); builder.RegisterType <CultureViewConfigurer>() .As <IConfigureDialogViews>() .As <IConfigureWindowViews>() .SingleInstance(); builder.RegisterType <DpiAwareViewConfigurer>() .As <IConfigureDialogViews>() .As <IConfigureWindowViews>() .SingleInstance(); builder.RegisterType <IconViewConfigurer>() .As <IConfigureDialogViews>() .As <IConfigureWindowViews>() .SingleInstance(); builder.RegisterType <PlacementViewConfigurer>() .As <IConfigureDialogViews>() .As <IConfigureWindowViews>() .SingleInstance(); builder.RegisterType <DapploWindowManager>() .As <IWindowManager>() .SingleInstance(); base.Load(builder); }
/// <inheritdoc /> protected override void Load(ContainerBuilder builder) { builder .Register(c => Language <ICredentialsTranslations> .Create()) .As <ICredentialsTranslations>() .As <ILanguage>() .SingleInstance(); builder .Register(c => { var metroConfiguration = IniSection <IMetroConfiguration> .Create(); // add specific code var metroThemeManager = c.Resolve <MetroThemeManager>(); metroConfiguration.RegisterAfterLoad(iniSection => { if (!(iniSection is IMetroUiConfiguration metroConfig)) { return; } // following must be done on the UI thread Execute.OnUIThread(() => { metroThemeManager.ChangeTheme(metroConfig.Theme, metroConfig.ThemeColor); }); }); return(metroConfiguration); }) .As <IMetroUiConfiguration>() .As <IMetroConfiguration>() .As <IIniSection>() .SingleInstance(); builder .Register(c => Language <IUiTranslations> .Create()) .As <IUiTranslations>() .As <ILanguage>() .SingleInstance(); builder.RegisterType <ConfigureDefaults>().As <IService>().SingleInstance(); builder.RegisterType <ThemeConfigViewModel>().As <IConfigScreen>().SingleInstance(); base.Load(builder); }
/// <inheritdoc /> protected override void Load(ContainerBuilder builder) { builder .Register(c => IniSection <IExchangeConfig> .Create()) .As <IIniSection>() .As <IExchangeConfig>() .As <IMetroUiConfiguration>() .As <IUiConfiguration>() .SingleInstance(); builder .Register(c => Language <IContextMenuTranslations> .Create()) .As <IContextMenuTranslations>() .As <ILanguage>() .SingleInstance(); builder .Register(context => new ExchangeServiceContainer().Initialize()) .As <ExchangeServiceContainer>() .SingleInstance(); builder .RegisterType <ExchangeInstance>() .As <IService>() .SingleInstance(); builder .RegisterType <NewEmailHandler>() .As <IService>() .SingleInstance(); builder .RegisterType <ExchangeTrayIconViewModel>() .As <ITrayIconViewModel>() .WithAttributeFiltering() .SingleInstance(); builder.RegisterAssemblyTypes(ThisAssembly) .AssignableTo <IMenuItem>() .As <IMenuItem>() .SingleInstance(); base.Load(builder); }
/// <inheritdoc /> protected override void Load(ContainerBuilder builder) { // All IMenuItem with the context they belong to builder.RegisterAssemblyTypes(ThisAssembly) .AssignableTo <IMenuItem>() .As <IMenuItem>() .SingleInstance(); builder .Register(c => Language <IContextMenuTranslations> .Create()) .As <ILanguage>() .As <IContextMenuTranslations>() .SingleInstance(); builder .Register(c => Language <IPipTranslations> .Create()) .As <ILanguage>() .As <IPipTranslations>() .SingleInstance(); builder .Register(c => IniSection <ILogConfiguration> .Create()) .As <IIniSection>() .As <ILogConfiguration>() .SingleInstance(); builder .Register(c => { var metroConfiguration = IniSection <IPipConfiguration> .Create(); // add specific code var metroThemeManager = c.Resolve <MetroThemeManager>(); metroConfiguration.RegisterAfterLoad(iniSection => { if (!(iniSection is IMetroUiConfiguration metroConfig)) { return; } metroThemeManager.ChangeTheme(metroConfig.Theme, metroConfig.ThemeColor); }); return(metroConfiguration); }) .As <IMetroUiConfiguration>() .As <IPipConfiguration>() .As <IIniSection>() .SingleInstance(); // All config screens builder.RegisterAssemblyTypes(ThisAssembly) .AssignableTo <IConfigScreen>() .As <IConfigScreen>() .SingleInstance(); builder .RegisterType <LocationPool>() .SingleInstance(); builder .RegisterType <ConfigureUiDefaults>() .As <IService>() .SingleInstance(); builder .RegisterType <ConfigStartup>() .As <IService>() .SingleInstance(); builder .RegisterType <LoggerStartup>() .As <IService>() .SingleInstance(); builder .RegisterType <PipService>() .As <IService>() .SingleInstance(); builder .RegisterType <SystemTrayContextMenuViewModel>() .As <ITrayIconViewModel>() .WithAttributeFiltering() .SingleInstance(); builder .RegisterType <ConfigViewModel>() .AsSelf(); builder .RegisterType <ErrorViewModel>() .AsSelf(); }
/// <inheritdoc /> protected override void Load(ContainerBuilder builder) { // Specify the directories for the translations manually builder.Register(context => LanguageConfigBuilder.Create() .WithSpecificDirectories(ScanLocations.GenerateScanDirectories( #if NET471 "net471", #else "netcoreapp3.1", #endif "Application.Demo.Addon", "Application.Demo.MetroAddon", "Application.Demo.OverlayAddon").ToArray() ) .BuildLanguageConfig()) .As <LanguageConfig>() .SingleInstance(); builder .Register(c => Language <ICoreTranslations> .Create()) .As <ICoreTranslations>() .As <IErrorTranslations>() .As <ILanguage>() .SingleInstance(); builder .Register(c => IniSection <IDemoConfiguration> .Create()) .As <IDemoConfiguration>() .As <IIniSection>() .SingleInstance(); builder .Register(c => Language <IDemoConfigTranslations> .Create()) .As <IDemoConfigTranslations>() .As <ILanguage>() .SingleInstance(); builder .Register(c => Language <IContextMenuTranslations> .Create()) .As <IContextMenuTranslations>() .As <ILanguage>() .SingleInstance(); builder .Register(c => Language <IMenuTranslations> .Create()) .As <IMenuTranslations>() .As <ILanguage>() .SingleInstance(); builder .Register(c => Language <IToastTranslations> .Create()) .As <IToastTranslations>() .As <ILanguage>() .SingleInstance(); builder .Register(c => Language <IValidationErrors> .Create()) .As <IValidationErrors>() .As <ILanguage>() .SingleInstance(); builder .Register(c => Language <IWizardTranslations> .Create()) .As <IWizardTranslations>() .As <ILanguage>() .SingleInstance(); builder.RegisterType <DemoTrayIconViewModel>() .As <ITrayIconViewModel>() .WithAttributeFiltering() .SingleInstance(); builder.RegisterType <AuthenticationProvider>() .As <IAuthenticationProvider>() .SingleInstance(); builder.RegisterType <NotifyOfStartupReady>() .As <IService>() .SingleInstance(); builder.RegisterType <SimpleVersionProvider>() .As <IVersionProvider>() .SingleInstance(); // All IMenuItem with the context they belong to builder.RegisterAssemblyTypes(ThisAssembly) .AssignableTo <IMenuItem>() .As <IMenuItem>() .SingleInstance(); // All config screens builder.RegisterAssemblyTypes(ThisAssembly) .AssignableTo <IConfigScreen>() .As <IConfigScreen>() .AsSelf() .SingleInstance(); // All wizard screens builder.RegisterAssemblyTypes(ThisAssembly) .AssignableTo <IWizardScreen>() .As <IWizardScreen>() .SingleInstance(); builder.RegisterType <ConfigViewModel>() .AsSelf() .SingleInstance(); // View models builder.RegisterType <WindowWithMenuViewModel>() .AsSelf() .WithAttributeFiltering() .SingleInstance(); builder.RegisterType <StartupReadyToastViewModel>() .AsSelf() .SingleInstance(); builder.RegisterType <WizardExampleViewModel>() .AsSelf() .SingleInstance(); // Not a single instance builder.RegisterType <ToastExampleViewModel>() .AsSelf(); builder.RegisterType <AllowAllKeyInputEventHandler>() .As <IKeyboardEventHandler>() .SingleInstance(); base.Load(builder); }
/// <inheritdoc /> protected override void Load(ContainerBuilder builder) { builder .Register(c => { var metroConfiguration = IniSection <IDopyUiConfiguration> .Create(); // add specific code var metroThemeManager = c.Resolve <MetroThemeManager>(); metroConfiguration.RegisterAfterLoad(iniSection => { metroThemeManager.ChangeTheme(metroConfiguration.Theme, metroConfiguration.ThemeColor); }); return(metroConfiguration); }) .As <IDopyUiConfiguration>() .As <IIniSection>() .As <IMetroUiConfiguration>() .As <IUiConfiguration>() .SingleInstance(); builder .Register(c => IniSection <IDopyConfiguration> .Create()) .As <IDopyConfiguration>() .As <IIniSection>() .SingleInstance(); builder .Register(c => Language <IConfigTranslations> .Create()) .As <IConfigTranslations>() .As <ILanguage>() .SingleInstance(); builder .Register(c => Language <ICoreTranslations> .Create()) .As <ICoreTranslations>() .As <ILanguage>() .SingleInstance(); builder .Register(c => Language <IMainContextMenuTranslations> .Create()) .As <IMainContextMenuTranslations>() .As <ILanguage>() .SingleInstance(); builder .RegisterType <ConfigViewModel>() .AsSelf(); // All config screens builder .RegisterAssemblyTypes(ThisAssembly) .AssignableTo <IConfigScreen>() .As <IConfigScreen>() .SingleInstance(); builder .RegisterType <DapploTrayIconViewModel>() .As <ITrayIconViewModel>() .WithAttributeFiltering() .SingleInstance(); // All IMenuItem with the context they belong to builder .RegisterAssemblyTypes(ThisAssembly) .AssignableTo <IMenuItem>() .As <IMenuItem>() .WithAttributeFiltering() .SingleInstance(); builder .Register(c => Language <IDopyTranslations> .Create()) .As <IDopyTranslations>() .As <ILanguage>() .SingleInstance(); builder .RegisterType <ClipboardStoreService>() .As <IService>() .WithAttributeFiltering() .SingleInstance(); builder .RegisterType <HistoryViewModel>() .AsSelf() .WithAttributeFiltering(); base.Load(builder); }