public ProductsPresenterService(IDatabaseAccessService databaseAccessService, IEventAggregator eventAggregator, IRegionManager regionManager)
        {
            this.regionManager = regionManager;

            foreach (var databaseHandlerService in databaseAccessService.DatabaseHandlers)
            {
                var wrapper = new ProductsPresenterWrapper();

                var loadingViewModel = new LoadingViewModel();
                var loadingGrid = new LoadingGrid(loadingViewModel);

                var productsViewModel = new ProductsViewModel(databaseHandlerService, eventAggregator, loadingViewModel);
                var productsGrid = new ProductsGrid(productsViewModel);

                var productEditorViewModel = new ProductEditorViewModel(databaseHandlerService, eventAggregator, productsViewModel);
                var productEditorGrid = new ProductEditorGrid(productEditorViewModel);

                wrapper.LoadingGrid = loadingGrid;
                wrapper.ProductsGrid = productsGrid;
                wrapper.ProductEditorGrid = productEditorGrid;

                wrappers.Add(databaseHandlerService.ConnectionString, wrapper);
            }

            var connectionStringChangedEvent = eventAggregator.GetEvent<ConnectionStringChangedEvent>();
            connectionStringChangedEvent.Subscribe(SetCurrentConnectionString);

            var visualizeModuleEvent = eventAggregator.GetEvent<VisualizeModuleEvent>();
            visualizeModuleEvent.Subscribe(VisualizeModule);
        }
예제 #2
0
        public LoadingGrid(LoadingViewModel viewModel)
        {
            InitializeComponent();

            Loaded += (s, e) => { DataContext = viewModel; };
        }