Beispiel #1
0
        public static void Start()
        {
            UI.BootStrapping.ApplicationStartup.Initialize(LogLevel.Debug);

            var container = IoC.Container;

            using (container.OptimizeDependencyResolution())
            {
                container.AddRegister(x => x.FromType <CoreRegister>());
                container.AddRegister(x => x.FromType <PresenterRegister>());
                container.AddRegister(x => x.FromType <InfrastructureRegister>());
                container.AddRegister(x => x.FromType <BatchRegister>());
                container.AddRegister(x => x.FromType <CLIRegister>());

                InfrastructureRegister.LoadSerializers(container);
                InfrastructureRegister.RegisterWorkspace(container);
                UI.BootStrapping.ApplicationStartup.RegisterCommands(container);
                container.RegisterImplementationOf(new DefaultLookAndFeel().LookAndFeel);
            }

            var skinManager  = container.Resolve <ISkinManager>();
            var userSettings = container.Resolve <IPresentationUserSettings>();

            skinManager.ActivateSkin(userSettings, Constants.DEFAULT_SKIN);
        }
        public static void Start()
        {
            BootStrapping.ApplicationStartup.Initialize(LogLevel.Debug);

            var container = IoC.Container;

            using (container.OptimizeDependencyResolution())
            {
                container.AddRegister(x => x.FromType <CoreRegister>());
                container.AddRegister(x => x.FromType <PresenterRegister>());
                container.AddRegister(x => x.FromType <InfrastructureRegister>());
                container.AddRegister(x => x.FromType <StarterRegister>());

                registerMinimalImplementations(container);
                registerUIImplementation(container);

                InfrastructureRegister.LoadSerializers(container);
                InfrastructureRegister.RegisterWorkspace(container);
                BootStrapping.ApplicationStartup.RegisterCommands(container);
                container.RegisterImplementationOf(new DefaultLookAndFeel().LookAndFeel);
            }

            container.Register <IToolTipCreator, OSPSuite.UI.Services.IToolTipCreator, ToolTipCreator>(LifeStyle.Transient);
            var skinManager  = container.Resolve <ISkinManager>();
            var userSettings = container.Resolve <IPresentationUserSettings>();
            // skinManager.ActivateSkin(userSettings, Constants.DEFAULT_SKIN);
        }
Beispiel #3
0
        public override void GlobalContext()
        {
            base.GlobalContext();
            if (IoC.Container != null)
            {
                return;
            }

            var container = InfrastructureRegister.Initialize();

            //use only in tests
            using (container.OptimizeDependencyResolution())
            {
                //need to register these series for which the default implementation is in the UI
                container.RegisterImplementationOf(new SynchronizationContext());
                container.Register <IApplicationController, ApplicationController>(LifeStyle.Singleton);
                container.Register <IExceptionManager, ExceptionManagerForSpecs>(LifeStyle.Singleton);
                container.Register <IDisplayUnitRetriever, CLIDisplayUnitRetriever>();
                container.Register <IOntogenyFactorsRetriever, OntogenyFactorsRetriever>();
                container.Register <ISimulationConstructor, SimulationConstructor>();
                container.RegisterImplementationOf(A.Fake <IProgressUpdater>());
                container.RegisterImplementationOf(A.Fake <IDialogCreator>());
                container.RegisterImplementationOf(A.Fake <IHistoryManager>());
                container.RegisterImplementationOf(A.Fake <IHeavyWorkManager>());
                container.RegisterImplementationOf(A.Fake <IChartTemplatingTask>());
                container.RegisterImplementationOf(A.Fake <IPresentationSettingsTask>());
                container.RegisterImplementationOf(A.Fake <IJournalDiagramManagerFactory>());

                container.AddRegister(x =>
                {
                    x.FromType <CoreRegister>();
                    x.FromType <EngineRegister>();
                    x.FromType <CLIRegister>();
                    x.FromType <InfrastructureRegister>();
                    x.FromType <PresenterRegister>();
                    x.FromType <OSPSuite.Presentation.PresenterRegister>();
                    x.FromType <BatchRegister>();
                });


                var userSettings = container.Resolve <IUserSettings>();
                userSettings.AbsTol = 1e-10;
                userSettings.RelTol = 1e-5;
                //this is use to create reports
                userSettings.NumberOfBins = CoreConstants.DEFAULT_NUMBER_OF_BINS;


                InfrastructureRegister.RegisterSerializationDependencies();
                InfrastructureRegister.RegisterWorkspace();

                var configuration = container.Resolve <IApplicationConfiguration>();
                XMLSchemaCache.InitializeFromFile(configuration.SimModelSchemaFilePath);
            }

            //Required for usage with nunit 3
            Environment.CurrentDirectory = AppDomain.CurrentDomain.BaseDirectory;
        }
Beispiel #4
0
 private static void registerCLITypes(IContainer container)
 {
     container.Register <IProgressUpdater, CLIProgressUpdater>();
     container.Register <IDialogCreator, CLIDialogCreator>();
     container.Register <IDisplayUnitRetriever, CLIDisplayUnitRetriever>();
     container.Register <IJournalDiagramManagerFactory, CLIJournalDiagramManagerFactory>();
     container.Register <IDiagramModel, CLIDiagramModel>();
     container.Register <IDiagramModelToXmlMapper, CLIDiagramModelToXmlMapper>(LifeStyle.Singleton);
     container.Register <IHistoryManager, HistoryManager <IExecutionContext> >();
     container.Register <ICoreUserSettings, OSPSuite.Core.ICoreUserSettings, IPresentationUserSettings, CLIUserSettings>(LifeStyle.Singleton);
     InfrastructureRegister.RegisterWorkspace <CLIWorkspace>();
 }
        /// <summary>
        ///    All specific registration that needs to be performed once all other registrations are done
        /// </summary>
        private void finalizeRegistration(IContainer container)
        {
            InfrastructureRegister.RegisterWorkspace(container);
            //Create one instance of the invokers so that the object is available in the application
            //since the object is not created anywhere and is only used as event listener
            container.Resolve <ICloseSubjectPresenterInvoker>();

            var mainPresenter = container.Resolve <IMainViewPresenter>();

            container.RegisterImplementationOf((IChangePropagator)mainPresenter);

            //This runner is only register when running PKSim as an executable. All other implementation should use the ISimulationRunner
            container.Register <IInteractiveSimulationRunner, InteractiveSimulationRunner>(LifeStyle.Singleton);
        }
Beispiel #6
0
        private void initializeForMatlab()
        {
            if (IoC.Container != null)
            {
                return;
            }

            InfrastructureRegister.Initialize();
            var container = IoC.Container;

            using (container.OptimizeDependencyResolution())
            {
                container.RegisterImplementationOf(new SynchronizationContext());
                container.AddRegister(x => x.FromType <MatlabRegister>());
                container.AddRegister(x => x.FromType <CoreRegister>());
                container.AddRegister(x => x.FromType <InfrastructureRegister>());

                //no computation required in matlab interface
                InfrastructureRegister.RegisterSerializationDependencies(registerSimModelSchema: false);
                InfrastructureRegister.RegisterWorkspace <CLIWorkspace>();
            }
        }