Exemple #1
0
        private static int StartApplication(string[] args, Func <Bootstrapper> getBootstrapperFunc)
        {
            Application.EnableVisualStyles();

            Thread.CurrentThread.Name = "ProgramThread";

            InitializeLogging();
            Logger.Debug("Starting PDFCreator");

            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;

            var bootstrapper = getBootstrapperFunc();

            _container = new Container();

            var profileSettingsTabs     = bootstrapper.DefineProfileSettingsTabs();
            var applicationSettingsTabs = bootstrapper.DefineApplicationSettingsTabs();

            var prismBootstrapper = new PrismBootstrapper(profileSettingsTabs, applicationSettingsTabs);

            prismBootstrapper.ConfigurePrismDependecies(_container);
            prismBootstrapper.RegisterNavigationViews(_container);

            bootstrapper.ConfigureContainer(_container);
            bootstrapper.RegisterInteractions();

            ViewRegistry.WindowFactory = new DelegateWindowFactory(content =>
            {
                var window     = _container.GetInstance <InteractionHostWindow>();
                window.Content = content;

                return(window);
            });

            if (Debugger.IsAttached)
            {
                _container.Verify(VerificationOption.VerifyOnly);
            }

            bootstrapper.RegisterEditiondependentRegions(_container.GetInstance <IRegionManager>());
            prismBootstrapper.InitPrismStuff(_container);

            var resolver = new SimpleInjectorAppStartResolver(_container);

            var appStartFactory = new AppStartFactory(resolver);
            var appStart        = appStartFactory.CreateApplicationStart(args);

            var helpCommandHandler = _container.GetInstance <HelpCommandHandler>();
            var settingsManager    = _container.GetInstance <ISettingsManager>();

            var app = new App(appStart, helpCommandHandler, settingsManager);

            app.DispatcherUnhandledException += Application_DispatcherUnhandledException;
            return(app.Run());
        }
Exemple #2
0
        private Container BuildPrismContainer(Bootstrapper bootstrapper)
        {
            var container = BuildContainer(bootstrapper);

            var prismBootstrapper = new PrismBootstrapper(bootstrapper.DefineProfileSettingsTabs(), bootstrapper.DefineApplicationSettingsTabs());

            prismBootstrapper.ConfigurePrismDependecies(container);
            prismBootstrapper.RegisterNavigationViews(container);

            return(container);
        }