예제 #1
0
        public MainWindow()
        {
            InitializeComponent();

            unityContainer = new UnityContainer();

            UiHiitInitializer.Init(unityContainer);
            HiitBoundedContextInitializer.Init(unityContainer);
            HiitWinInitializer.Init(unityContainer);

            UiEnduranceInitializer.Init(unityContainer);

            var useServiceImplementation = false;

            if (useServiceImplementation)
            {
                EnduranceServiceMockInitializer.Init(unityContainer);
            }
            else
            {
                EnduranceBoundedContextInitializer.Init(unityContainer);
                EnduranceWinInitializer.Init(unityContainer);
            }

            PeripheralBoundedContextInitializer.Init(unityContainer);

            unityContainer.RegisterType <MainWindowViewModel>(new ContainerControlledLifetimeManager());

            unityContainer.RegisterType <ICommand, StartRunningUiCommand>(nameof(StartRunningUiCommand));
            unityContainer.RegisterType <ICommand, StartHiitUiCommand>(nameof(StartHiitUiCommand));

            DataContext = unityContainer.Resolve <MainWindowViewModel>();
        }
예제 #2
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddControllers();
            services.AddSwaggerGen(c =>
            {
                c.SwaggerDoc("v1", new OpenApiInfo {
                    Title = "SportsCompany.FitnessTracker.Endurance.WebApi", Version = "v1"
                });
            });

            var unityContainer = new UnityContainer();

            EnduranceBoundedContextInitializer.Init(unityContainer);
            EnduranceWinInitializer.Init(unityContainer);
            PeripheralBoundedContextInitializer.Init(unityContainer);

            services.AddSingleton <IUnityContainer>(unityContainer);
        }