void IHandle <LoggedInMessage> .Handle(LoggedInMessage message) { var dashboard = _screenFactory.CreateScreen <DashboardViewModel>(); dashboard.Init(message.User); ActiveItem = dashboard; }
public void ConnectToMessageQueue() { var machineViewModel = _screenFactory.CreateScreen <IConnectToMachineViewModel>(); var result = _windowManager.ShowDialog(machineViewModel); if (result.GetValueOrDefault(false)) { QueueExplorer.ConnectToQueue(machineViewModel.ComputerName); } }
public void TestInitialize() { ScreenFactory = Substitute.For <IScreenFactory>(); WindowManager = Substitute.For <IWindowManagerEx>(); QueueExplorer = Substitute.For <IQueueExplorerViewModel>(); EndpointExplorer = Substitute.For <IEndpointExplorerViewModel>(); MessageList = Substitute.For <IMessageListViewModel>(); StatusbarManager = Substitute.For <IStatusBarManager>(); EventAggregator = Substitute.For <IEventAggregator>(); MessageFlow = Substitute.For <IMessageFlowViewModel>(); SagaWindow = Substitute.For <ISagaWindowViewModel>(); MessageBodyView = Substitute.For <IMessageBodyViewModel>(); MessageProperties = Substitute.For <IMessagePropertiesViewModel>(); View = Substitute.For <IShellViewStub>(); HeaderView = Substitute.For <IMessageHeadersViewModel>(); SettingsProvider = Substitute.For <ISettingsProvider>(); LicenseManager = Substitute.For <AppLicenseManager>(); LogWindow = Substitute.For <ILogWindowViewModel>(); ConnectToViewModel = Substitute.For <IConnectToMachineViewModel>(); SettingsProvider.GetSettings <ProfilerSettings>().Returns(DefaultAppSetting()); App = Substitute.For <IAppCommands>(); CommandLineArgParser = MockEmptyStartupOptions(); shell = new ShellViewModel(App, ScreenFactory, WindowManager, QueueExplorer, EndpointExplorer, MessageList, StatusbarManager, EventAggregator, LicenseManager, MessageFlow, SagaWindow, MessageBodyView, HeaderView, SettingsProvider, MessageProperties, LogWindow, CommandLineArgParser); ScreenFactory.CreateScreen <IConnectToMachineViewModel>().Returns(ConnectToViewModel); shell.AttachView(View, null); }
public void TestInitialize() { ScreenFactory = Substitute.For <IScreenFactory>(); WindowManager = Substitute.For <IWindowManagerEx>(); QueueExplorer = Substitute.For <IQueueExplorerViewModel>(); EndpointExplorer = Substitute.For <IEndpointExplorerViewModel>(); MessageList = Substitute.For <IMessageListViewModel>(); NetworkOperations = Substitute.For <INetworkOperations>(); ExceptionHandler = Substitute.For <IExceptionHandler>(); StatusbarManager = Substitute.For <StatusBarManager>(); EventAggregator = Substitute.For <IEventAggregator>(); MessageFlow = Substitute.For <IMessageFlowViewModel>(); MessageBodyView = Substitute.For <IMessageBodyViewModel>(); MessageProperties = Substitute.For <IMessagePropertiesViewModel>(); View = Substitute.For <IShellViewStub>(); SettingsProvider = Substitute.For <ISettingsProvider>(); LicenseManager = Substitute.For <ILicenseManager>(); LogWindow = Substitute.For <ILogWindowViewModel>(); ConnectToViewModel = Substitute.For <ConnectToMachineViewModel>(NetworkOperations); SettingsProvider.GetSettings <ProfilerSettings>().Returns(DefaultAppSetting()); App = Substitute.For <IAppCommands>(); shell = new ShellViewModel(App, ScreenFactory, WindowManager, QueueExplorer, EndpointExplorer, MessageList, StatusbarManager, EventAggregator, LicenseManager, MessageFlow, MessageBodyView, SettingsProvider, MessageProperties, LogWindow); ScreenFactory.CreateScreen <ConnectToMachineViewModel>().Returns(ConnectToViewModel); shell.AttachView(View, null); }
public void ShowException(IExceptionDetails exception) { var model = _screenFactory.CreateScreen <IExceptionDetailViewModel>(); model.Exception = exception; _windowManager.ShowDialog(model, true); }
public bool?ShowDialog <T>() where T : class { _allowResize = false; var screen = _screenFactory.CreateScreen <T>(); return(base.ShowDialog(screen, null)); }
void IHandle <ChangeAuthenticationManagerStateMessage> .Handle(ChangeAuthenticationManagerStateMessage message) { ActiveItem = GetScreenByState(message.State); IScreen GetScreenByState(AuthenticationManagerState state) { switch (state) { case AuthenticationManagerState.Login: return(_screenFactory.CreateScreen <LoginViewModel>()); case AuthenticationManagerState.Register: return(_screenFactory.CreateScreen <RegisterViewModel>()); default: throw new ArgumentOutOfRangeException(nameof(state)); } } }
[Ignore] //TODO: NSubstitute doesn't play well with the inner async call public void should_refresh_queue_exporer_when_new_queue_is_created() { var viewModel = Substitute.For <IQueueCreationViewModel>(); ScreenFactory.CreateScreen <IQueueCreationViewModel>().Returns(viewModel); WindowManager.ShowDialog(viewModel).Returns(true); AsyncHelper.Run(() => shell.CreateQueue()); QueueExplorer.RefreshData().ReceivedCalls(); //TODO: Comment? }
public bool Activate(bool instancePreserved) { #if !WINDOWS_PHONE return(false); #else // If the game instance was preserved, the game wasn't dehydrated so our screens still exist. // We just need to activate them and we're ready to go. if (instancePreserved) { // Make a copy of the master screen list, to avoid confusion if // the process of activating one screen adds or removes others. tempScreensList.Clear(); foreach (GameScreen screen in screens) { tempScreensList.Add(screen); } foreach (GameScreen screen in tempScreensList) { screen.Activate(true); } } // Otherwise we need to refer to our saved file and reconstruct the screens that were present // when the game was deactivated. else { // Try to get the screen factory from the services, which is required to recreate the screens IScreenFactory screenFactory = Game.Services.GetService(typeof(IScreenFactory)) as IScreenFactory; if (screenFactory == null) { throw new InvalidOperationException( "Game.Services must contain an IScreenFactory in order to activate the ScreenManager."); } // Open up isolated storage using (IsolatedStorageFile storage = IsolatedStorageFile.GetUserStoreForApplication()) { // Check for the file; if it doesn't exist we can't restore state if (!storage.FileExists(StateFilename)) { return(false); } // Read the state file so we can build up our screens using (IsolatedStorageFileStream stream = storage.OpenFile(StateFilename, FileMode.Open)) { XDocument doc = XDocument.Load(stream); // Iterate the document to recreate the screen stack foreach (XElement screenElem in doc.Root.Elements("GameScreen")) { // Use the factory to create the screen Type screenType = Type.GetType(screenElem.Attribute("Type").Value); GameScreen screen = screenFactory.CreateScreen(screenType); // Rehydrate the controlling player for the screen PlayerIndex?controllingPlayer = screenElem.Attribute("ControllingPlayer").Value != "" ? (PlayerIndex)Enum.Parse(typeof(PlayerIndex), screenElem.Attribute("ControllingPlayer").Value, true) : (PlayerIndex?)null; screen.ControllingPlayer = controllingPlayer; // Add the screen to the screens list and activate the screen screen.ScreenManager = this; screens.Add(screen); screen.Activate(false); // update the TouchPanel to respond to gestures this screen is interested in TouchPanel.EnabledGestures = screen.EnabledGestures; } } } } return(true); #endif }
public virtual void ShowAbout() { var aboutViewModel = _screenFactory.CreateScreen <AboutViewModel>(); _windowManager.ShowDialog(aboutViewModel); }
public void TestInitialize() { ScreenFactory = Substitute.For<IScreenFactory>(); WindowManager = Substitute.For<IWindowManagerEx>(); QueueExplorer = Substitute.For<IQueueExplorerViewModel>(); EndpointExplorer = Substitute.For<IEndpointExplorerViewModel>(); MessageList = Substitute.For<IMessageListViewModel>(); NetworkOperations = Substitute.For<INetworkOperations>(); ExceptionHandler = Substitute.For<IExceptionHandler>(); StatusbarManager = Substitute.For<StatusBarManager>(); EventAggregator = Substitute.For<IEventAggregator>(); MessageFlow = Substitute.For<IMessageFlowViewModel>(); MessageBodyView = Substitute.For<IMessageBodyViewModel>(); MessageProperties = Substitute.For<IMessagePropertiesViewModel>(); View = Substitute.For<IShellViewStub>(); SettingsProvider = Substitute.For<ISettingsProvider>(); LicenseManager = Substitute.For<ILicenseManager>(); LogWindow = Substitute.For<ILogWindowViewModel>(); ConnectToViewModel = Substitute.For<ConnectToMachineViewModel>(NetworkOperations); SettingsProvider.GetSettings<ProfilerSettings>().Returns(DefaultAppSetting()); App = Substitute.For<IAppCommands>(); shell = new ShellViewModel(App, ScreenFactory, WindowManager, QueueExplorer, EndpointExplorer, MessageList, StatusbarManager, EventAggregator, LicenseManager, MessageFlow, MessageBodyView, SettingsProvider, MessageProperties, LogWindow); ScreenFactory.CreateScreen<ConnectToMachineViewModel>().Returns(ConnectToViewModel); shell.AttachView(View, null); }
public void TestInitialize() { ScreenFactory = Substitute.For<IScreenFactory>(); WindowManager = Substitute.For<IWindowManagerEx>(); QueueExplorer = Substitute.For<IQueueExplorerViewModel>(); EndpointExplorer = Substitute.For<IEndpointExplorerViewModel>(); MessageList = Substitute.For<IMessageListViewModel>(); StatusbarManager = Substitute.For<IStatusBarManager>(); EventAggregator = Substitute.For<IEventAggregator>(); MessageFlow = Substitute.For<IMessageFlowViewModel>(); SagaWindow = Substitute.For<ISagaWindowViewModel>(); MessageBodyView = Substitute.For<IMessageBodyViewModel>(); MessageProperties = Substitute.For<IMessagePropertiesViewModel>(); View = Substitute.For<IShellViewStub>(); HeaderView = Substitute.For<IMessageHeadersViewModel>(); SettingsProvider = Substitute.For<ISettingsProvider>(); LicenseManager = Substitute.For<AppLicenseManager>(); LogWindow = Substitute.For<ILogWindowViewModel>(); ConnectToViewModel = Substitute.For<IConnectToMachineViewModel>(); SettingsProvider.GetSettings<ProfilerSettings>().Returns(DefaultAppSetting()); App = Substitute.For<IAppCommands>(); CommandLineArgParser = MockEmptyStartupOptions(); shell = new ShellViewModel(App, ScreenFactory, WindowManager, QueueExplorer, EndpointExplorer, MessageList, StatusbarManager, EventAggregator, LicenseManager, MessageFlow, SagaWindow, MessageBodyView, HeaderView, SettingsProvider, MessageProperties, LogWindow, CommandLineArgParser); ScreenFactory.CreateScreen<IConnectToMachineViewModel>().Returns(ConnectToViewModel); shell.AttachView(View, null); }