示例#1
0
        private void SwitchScreen(IMenuInfo menuInfo)
        {
            IScreen screen;

            if (menuInfo == null)
            {
                return;
            }

            if (!_userSession.IsLoggedIn)
            {
                return;
            }

            //If screen already exists, activate it
            if (_screenDictionary.ContainsKey(menuInfo.ScreenGuid))
            {
                screen = _screenDictionary[menuInfo.ScreenGuid];

                if (screen.IsActive)
                {
                    return;
                }

                if (screen is IDialogScreen)
                {
                    ((IDialogScreen)screen).Open();
                    return;
                }

                var mainRegion = _regionManager.Regions[_appSettings.RegionNames.MainRegion];
                RemoveActiveScreen();
                var view = mainRegion.GetView(screen.Guid.ToString());
                mainRegion.Activate(view);
                _screenDictionary[menuInfo.ScreenGuid].IsActive = true;
            }
            else
            {
                var factory    = _factoryRegistry.GetFactory(menuInfo.ScreenGuid);
                var mainRegion = _regionManager.Regions[_appSettings.RegionNames.MainRegion];

                screen = factory.CreateScreen(mainRegion, menuInfo.ScreenGuid);
                var screenAttribute = screen.GetScreenAttribute();
                if (screen is IDialogScreen)
                {
                    ((IDialogScreen)screen).Open();
                    _busyService.HideBusy("SwitchScreen");
                    _screenDictionary.Add(menuInfo.ScreenGuid, screen);
                    return;
                }

                RemoveActiveScreen();
                mainRegion.Activate(screen.MasterView);

                screen.IsActive = true;
                _screenDictionary.Add(menuInfo.ScreenGuid, screen);
            }
            //_busyService.HideBusy("SwitchScreen");
            _transitionService.EnterViewAnimation(screen.MasterView);
        }
示例#2
0
        public void SwitchScreen(IMenuInfo menuInfo)
        {
            IScreen screen;

            //If screen already exists, activate it
            if (_screenDictionary.ContainsKey(menuInfo.ScreenGuid))
            {
                screen = _screenDictionary[menuInfo.ScreenGuid];
                if (screen.IsActive)
                {
                    return;
                }

                var mainRegion = _regionManager.Regions[_appSettings.RegionNames.MainRegion];
                RemoveActiveScreen();
                var view = mainRegion.GetView(screen.Guid.ToString());
                mainRegion.Activate(view);
                _screenDictionary[menuInfo.ScreenGuid].IsActive = true;
            }
            //Else create new
            else
            {
                RemoveActiveScreen();
                var factory    = _factoryRegistry.GetFactory(menuInfo.ScreenGuid);
                var mainRegion = _regionManager.Regions[_appSettings.RegionNames.MainRegion];

                screen = factory.CreateScreen(mainRegion, menuInfo.ScreenGuid);

                if (screen != null)
                {
                    screen.IsActive = true;
                    _screenDictionary.Add(menuInfo.ScreenGuid, screen);
                }
            }
            _transitionService.EnterViewAnimation(screen.MasterView);
        }