Beispiel #1
0
        public void Init()
        {
            container = new WindsorContainer();
            Container.Register(Component.For <IWindsorContainer>().Instance(Container));

            ContainerManager.Container = Container;

            var preActiation = new PreActivation(Container);

            preActiation.Init();

            var activator = new ModuleActivator();

            activator.RegisterComponents(Container);

            var migrator       = Container.Resolve <IMigrator>();
            var needMigrations = migrator.GetMigrations();

            if (needMigrations.Any())
            {
                migrator.Migrate();
            }
            else
            {
            }
        }
Beispiel #2
0
        public PageControllerModel(
            PageControllerToken token,
            ModuleActivator activator,
            PageControllerReducer reducer,
            SerialUtil serialUtil,
            MainReducer mainReducer,
            WindowPageHost windowPageHost,
            DatabaseManager databaseManager,
            DatabaseBackupService databaseBackupService
            )
        {
            _activator             = activator;
            _windowPageHost        = windowPageHost;
            _databaseManager       = databaseManager;
            _databaseBackupService = databaseBackupService;
            this._serialUtil       = serialUtil;
            InitHandlers();
            ActivateContent(token);

            this.WhenActivated((c) => {
                mainReducer.Select(state => state.FullscreenMode)
                .ObserveOnDispatcher(DispatcherPriority.Background)
                .Subscribe(isFullScreen => this.MenuVisibility = !isFullScreen)
                .DisposeWith(c);
                reducer.Select(state => state.SelectedPage)
                .Where(LambdaHelper.NotNull)
                .WithLatestFrom(reducer.Select(state => state.Controls), LambdaHelper.ToTuple)
                .ObserveOnDispatcher(DispatcherPriority.Background)
                .Subscribe(tuple => {
                    var(selectedPage, controlsDict) = tuple;
                    var controls = selectedPage == null
                            ? new List <ButtonConfig>()
                            : controlsDict.GetOrDefault(selectedPage.Id) ?? new List <ButtonConfig>();
                    SetActionButtons(controls);
                })
                .DisposeWith(c);
                _serialUtil.ConnectionStatus
                .ObserveOnDispatcher(DispatcherPriority.Background)
                .Select(status => status.IsConnected)
                .Subscribe(status => {
                    this.ReaderMenuText = status
                            ? Localization["Отключить считыватель"]
                            : Localization["Включить считыватель"];
                })
                .DisposeWith(c);
            });
        }
 public TabPageHost(IModuleToken token, ModuleActivator activator) : base(activator)
 {
     _token = token;
 }
 public WindowPageHost(IModuleToken token, ModuleActivator activator, MainReducer reducer) : base(activator)
 {
     _token   = token;
     _reducer = reducer;
 }
Beispiel #5
0
 protected AbstractPageHost(ModuleActivator activator)
 {
     _activator = activator;
 }
Beispiel #6
0
        protected void Application_Start()
        {
            State = ApplicationState.Initialize;

            Container = new WindsorContainer();
            Container.Register(Component.For <IWindsorContainer>().Instance(Container));

            ContainerManager.Container = Container;

            var preActiation = new PreActivation(Container);

            preActiation.Init();

            var activator = new ModuleActivator();

            activator.RegisterComponents(Container);

            Logger = Container.Resolve <Logging.Interfaces.ILogger>();

            DependencyResolver.SetResolver(new WindsorDependencyResolver(Container));
            ControllerBuilder.Current.SetControllerFactory(new WindsorControllerFactory(Container.Kernel));

            var filterContainers = Container.ResolveAll <IFilterContainer>();

            foreach (var filterContainer in filterContainers)
            {
                filterContainer.Init(GlobalFilters.Filters);
            }

            var routeContainers = Container.ResolveAll <IRouteContainer>();

            foreach (var routeContainer in routeContainers)
            {
                routeContainer.Init(RouteTable.Routes);
            }

            var boundleContainers = Container.ResolveAll <IBoundleContainer>();

            foreach (var boundleContainer in boundleContainers)
            {
                boundleContainer.Init(BundleTable.Bundles);
            }

            ///TODO: добавить режим обслуживания
            var migrator = Container.Resolve <IMigrator>();

            try
            {
                var needMigrations = migrator.GetMigrations();

                if (needMigrations.Any())
                {
                    migrator.Migrate();
                }
            }
            catch (Exception e)
            {
                State = ApplicationState.Error;

                throw;
            }

            State = ApplicationState.Started;
        }