public void HandleStartupActions(IRegionManager regionManager, StartupRoutine startupRoutine) { foreach (var action in startupRoutine.GetAllActions()) { switch (action) { case StartupNavigationAction navigationAction: regionManager.RequestNavigate(navigationAction.Region, navigationAction.Target); break; case StartupSelectTabAction tabAction: var region = regionManager.Regions[tabAction.TabRegion]; var view = region.Views.Where(v => v is TabItem).Cast <TabItem>().FirstOrDefault(t => t.Name == tabAction.TabName); if (view != null) { region.Activate(view); } else { regionManager.RequestNavigate(tabAction.TabRegion, tabAction.TabName); } break; } } }
public void ShowMainShell(StartupRoutine routine) { lock (this) { if (MainShell == null) { MainShell = _serviceLocator.GetInstance <MainShell>(); RegionManager.SetRegionManager(MainShell, _regionManager); RegionManager.UpdateRegions(); RegisterStartingViewsInMainShellRegions(); MainShell.ViewModel.MainShellStartupAction(routine); } } AvoidWpfDesignerDeadlock(); try { _topMostHelper.ShowDialogTopMost(MainShell, true); } finally { UnregisterRegions(new RegionNames()); MainShell = null; } }
public void Execute(object parameter) { var startup = new StartupRoutine(); startup.AddAction(new StartupNavigationAction(RegionNames.MainRegion, MainRegionViewNames.ProfilesView)); _mainWindowThreadLauncher.LaunchMainWindow(startup); }
public ShellManager(IWhitelistedServiceLocator serviceLocator, IRegionManager regionManager, IWpfTopMostHelper topMostHelper, IProfileSettingsTabs profileSettingsTabs, IApplicationSettingsTabs applicationSettingsTabs, IEnumerable <IStartupAction> startupActions) { _regionManager = regionManager; _serviceLocator = serviceLocator; _topMostHelper = topMostHelper; _profileSettingsTabs = profileSettingsTabs; _applicationSettingsTabs = applicationSettingsTabs; _startupRoutine = new StartupRoutine(startupActions); }
public void LaunchMainWindow(StartupRoutine startup) { if (_mainWindowThread != null) { _shellManager.MainShellToFront(); return; } _routine = startup; _mainWindowThread = _threadManager.StartSynchronizedUiThread(MainWindowLaunchThreadMethod, "MainWindowThread"); }
private void SetupActivePathInMainShell(StartupRoutine startupRoutine) { var startupNavigationActions = startupRoutine.GetActionByType <StartupNavigationAction>(); foreach (var startupNavigationAction in startupNavigationActions) { if (startupNavigationAction.Region == RegionNames.MainRegion) { ActivePath = startupNavigationAction.Target; } } }
public void MainShellStartupAction(StartupRoutine startupRoutine) { SetupActivePathInMainShell(startupRoutine); foreach (var startupNavigationAction in startupRoutine.GetActionByType <StartupNavigationAction>()) { _regionManager.RequestNavigate(startupNavigationAction.Region, startupNavigationAction.Target); } if (_welcomeSettingsHelper.IsFirstRun()) { _dispatcher.InvokeAsync(ShowWelcomeWindow); } }
private void MainWindowLaunchThreadMethod() { try { if (_routine == null) { _routine = new StartupRoutine(); } _shellManager.ShowMainShell(); } finally { _mainWindowThread = null; } }
private void MainWindowLaunchThreadMethod() { try { if (_routine == null) { _routine = new StartupRoutine(); _routine.AddAction(new StartupNavigationAction(RegionNames.MainRegion, MainRegionViewNames.HomeView)); } _shellManager.ShowMainShell(_routine); } finally { _mainWindowThread = null; } }
public void LaunchMainWindow(StartupRoutine startup) { throw new System.NotImplementedException(); }