Exemple #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);
        }
        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.RegisterImplementationOf(A.Fake <IDataImporter>());

                container.AddRegister(x =>
                {
                    x.FromType <CoreRegister>();
                    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.LoadSerializers(container);
                InfrastructureRegister.RegisterWorkspace(container);
            }

            //Required for usage with nunit 3
            Environment.CurrentDirectory = AppDomain.CurrentDomain.BaseDirectory;
        }
Exemple #4
0
        public static void Start()
        {
            var container = IoC.Container;

            using (container.OptimizeDependencyResolution())
            {
                container.RegisterImplementationOf(NumericFormatterOptions.Instance);

                registerCLITypes(container);

                container.AddRegister(x => x.FromType <CoreRegister>());
                container.AddRegister(x => x.FromType <InfrastructureRegister>());
                container.AddRegister(x => x.FromType <CLIRegister>());

                InfrastructureRegister.LoadSerializers(container);
            }
        }
Exemple #5
0
        private void initializeForMatlab()
        {
            if (IoC.Container != null)
            {
                return;
            }

            var container = InfrastructureRegister.Initialize();

            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>());

                InfrastructureRegister.LoadSerializers(container);
                container.Register <ICoreWorkspace, OSPSuite.Core.IWorkspace, CLIWorkspace>(LifeStyle.Singleton);
            }
        }
Exemple #6
0
        public void Start()
        {
            var progressManager = IoC.Resolve <IProgressManager>();
            var container       = IoC.Container;

            using (var progress = progressManager.Create())
            {
                progress.Initialize(8);

                using (container.OptimizeDependencyResolution())
                {
                    showStatusMessage(progress, PKSimConstants.UI.RegisterAssembly(PKSimConstants.UI.Core));
                    container.AddRegister(x => x.FromType <CoreRegister>());

                    showStatusMessage(progress, PKSimConstants.UI.RegisterAssembly(PKSimConstants.UI.Infrastructure));
                    container.AddRegister(x => x.FromType <InfrastructureRegister>());

                    showStatusMessage(progress, message: PKSimConstants.UI.RegisterAssembly(PKSimConstants.UI.Presentation));
                    container.AddRegister(x => x.FromType <Presentation.PresenterRegister>());

                    showStatusMessage(progress, PKSimConstants.UI.RegisterAssembly(PKSimConstants.UI.UserInterface));
                    container.AddRegister(x => x.FromType <UserInterfaceRegister>());

                    showStatusMessage(progress, PKSimConstants.UI.RegisterAssembly(PKSimConstants.UI.Commands));
                    RegisterCommands(container);

                    showStatusMessage(progress, PKSimConstants.UI.RegisterSerializationDependencies);
                    InfrastructureRegister.LoadSerializers(container);

                    finalizeRegistration(container);
                }

                showStatusMessage(progress, PKSimConstants.UI.StartingUserInterface);
                startStartableObject(container);
            }
        }