public void Initialize() { RegisterLoginViewsAndServices(); //Register home view var loginViewModel = _container.Resolve <ILoginViewModel>(); var loginNavItem = new NavigationItem(NavigationNames.LoginName, loginViewModel); loginViewModel.LogonViewRequestedEvent += (sender, args) => { BackgroundWorker _backgroundWorker = new BackgroundWorker(); _backgroundWorker.DoWork += (sender1, args1) => { try { InitializeModules(); NavigationNames.PublishStatusUpdate("Updating Dashboard"); InitializeUsersModule(); InitializeMainModule(); //should be last Application.Current.Dispatcher.Invoke(DispatcherPriority.Send, (Action) delegate { _navigationManager.ShowNavigationMenu(); _navigationManager.NavigateToDefaultPage(); _navigationManager.UnRegisterNavigationItem(loginNavItem); }); } catch (Exception e) { Application.Current.Dispatcher.Invoke(DispatcherPriority.Send, (Action) delegate { throw e; }); } }; _backgroundWorker.RunWorkerAsync(); }; _navigationManager.RegisterNavigationItem(loginNavItem); _navigationManager.Navigate(loginNavItem); }
private void InitializeModules() { var moduleManager = _container.Resolve <IModuleManager>(); NavigationNames.PublishStatusUpdate("Loading localization resources"); moduleManager.LoadModule("LocalizationModule"); // initialize it first NavigationNames.PublishStatusUpdate("Loading settings"); moduleManager.LoadModule("AppConfigModule"); moduleManager.LoadModule("ConfigurationModule"); moduleManager.LoadModule("AssetModule"); // AssetModule is loaded on demand as a dependency NavigationNames.PublishStatusUpdate("Loading Orders module"); moduleManager.LoadModule("OrderModule"); NavigationNames.PublishStatusUpdate("Loading Marketing module"); moduleManager.LoadModule("MarketingModule"); NavigationNames.PublishStatusUpdate("Loading Catalog module"); moduleManager.LoadModule("CatalogModule"); NavigationNames.PublishStatusUpdate("Loading Fulfillment module"); moduleManager.LoadModule("FulfillmentModule"); NavigationNames.PublishStatusUpdate("Loading Customers module"); moduleManager.LoadModule("CustomersModule"); NavigationNames.PublishStatusUpdate("Loading Reporting module"); moduleManager.LoadModule("ReportingModule"); }