Пример #1
0
        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;
                }
            }
        }
Пример #2
0
        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;
            }
        }
Пример #3
0
        public void Execute(object parameter)
        {
            var startup = new StartupRoutine();

            startup.AddAction(new StartupNavigationAction(RegionNames.MainRegion, MainRegionViewNames.ProfilesView));
            _mainWindowThreadLauncher.LaunchMainWindow(startup);
        }
Пример #4
0
 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);
 }
Пример #5
0
 public void LaunchMainWindow(StartupRoutine startup)
 {
     if (_mainWindowThread != null)
     {
         _shellManager.MainShellToFront();
         return;
     }
     _routine          = startup;
     _mainWindowThread = _threadManager.StartSynchronizedUiThread(MainWindowLaunchThreadMethod, "MainWindowThread");
 }
Пример #6
0
        private void SetupActivePathInMainShell(StartupRoutine startupRoutine)
        {
            var startupNavigationActions = startupRoutine.GetActionByType <StartupNavigationAction>();

            foreach (var startupNavigationAction in startupNavigationActions)
            {
                if (startupNavigationAction.Region == RegionNames.MainRegion)
                {
                    ActivePath = startupNavigationAction.Target;
                }
            }
        }
Пример #7
0
        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);
            }
        }
Пример #8
0
        private void MainWindowLaunchThreadMethod()
        {
            try
            {
                if (_routine == null)
                {
                    _routine = new StartupRoutine();
                }

                _shellManager.ShowMainShell();
            }
            finally
            {
                _mainWindowThread = null;
            }
        }
Пример #9
0
        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();
 }