Esempio n. 1
0
        public void RegisterTypes(IContainerProvider container)
        {
            var configurationBuilder = new ConfigurationBuilder();

            configurationBuilder.AddJsonFile("appsettings.json", false);
            var configuration = configurationBuilder.Build();

            container.RegisterInstance <IConfiguration>(configuration);

            container.RegisterFactory <ILogger>(c => LogManager.GetCurrentClassLogger());

            container.RegisterInstance <IDbContextFactory>(new DbContextFactory(() => new AppDbContext(container.GetDbContextOptions <AppDbContext>())));

            container.RegisterSingleton <INavigationManager, NavigationManager>();

            container.RegisterSingleton <IApplicationStateService, ApplicationStateService>();

            container.RegisterSingleton <IResourceRegistry, ResourceRegistry>();
            container.RegisterSingleton <IMenuItemRegistry, MenuItemRegistry>();
            container.RegisterSingleton <IToolBarRegistry, ToolBarRegistry>();
            container.RegisterSingleton <IWidgetRegistry, WidgetRegistry>();
            container.RegisterSingleton <IWidgetFactory, WidgetFactory>();

            container.RegisterSingleton <IRequestProcessorFactory, RequestProcessorFactory>();
            container.RegisterType <IRequestProcessor, ApiEventRequestProcessor>();
            container.RegisterSingleton <IApiServer, ApiServer>();
            container.RegisterInstance <IApiServerConfiguration>(new ApiConfiguration {
                PipeName = Globals.AppPipeName
            });
            container.RegisterSingleton <IApiClient, ApiClient>();
            container.RegisterInstance <IApiClientConfiguration>(new ApiConfiguration {
                PipeName = Globals.EnginePipeName
            });
            container.RegisterSingleton <IMessageSerializer, MessagePackMessageSerializer>();

            container.RegisterSingleton <ISettingsRegistry, SettingsRegistry>();
            container.RegisterSingleton <ISettingsService, SettingsService>();
            container.RegisterInstance <ISettingHandlerFactory>(new SettingHandlerFactory(t => (ISettingHandler)container.Resolve(t)));

            container.RegisterDialog <MessageBoxView, MessageBoxViewModel>();

            container.RegisterView <MainMenuView, MainMenuViewModel>();
            container.RegisterView <MainStatusBarView, MainStatusBarViewModel>();
            container.RegisterView <ToolBarView, ToolBarViewModel>();

            container.RegisterView <StartupView, StartupViewModel>();
            container.RegisterView <StatusView, StatusViewModel>();
            container.RegisterView <MainView, MainViewModel>();
            container.RegisterView <SettingsView, SettingsViewModel>();
            container.RegisterView <AboutView, AboutViewModel>();

            container.RegisterRequestProcessor <UpdatesRequestProcessor>();
            container.RegisterSingleton <IUpdateService, HttpUpdateService>();
            container.RegisterSingleton <UpdateHandler>();
        }
 /// <summary>
 /// Registers a dialog for use with the Prism <see cref="IDialogService"/>.
 /// </summary>
 /// <typeparam name="TView">The view type of the dialog.</typeparam>
 /// <typeparam name="TViewModel">The dialog's view model type.</typeparam>
 /// <param name="container">The container.</param>
 public static void RegisterDialog <TView, TViewModel>(this IContainerProvider container)
     where TView : FrameworkElement
     where TViewModel : IDialogAware, IViewModel
 {
     container.RegisterView <TView, TViewModel>();
 }
Esempio n. 3
0
 public void OnInitialized(IContainerProvider containerProvider)
 {
     containerProvider.RegisterView <ViewA>("MenuRegion");
 }