SEBWIN-360: Improved runtime performance by having only one splash screen.
This commit is contained in:
		
							parent
							
								
									19bf6df812
								
							
						
					
					
						commit
						42e107d7c7
					
				
					 3 changed files with 26 additions and 19 deletions
				
			
		|  | @ -43,14 +43,17 @@ namespace SafeExamBrowser.Runtime.UnitTests | |||
| 		private Mock<IMessageBox> messageBox; | ||||
| 		private SessionConfiguration nextSession; | ||||
| 		private AppSettings nextSettings; | ||||
| 		private Mock<Action> shutdown; | ||||
| 		private Mock<IText> text; | ||||
| 		private Mock<IUserInterfaceFactory> uiFactory; | ||||
| 		private RuntimeController sut; | ||||
| 		private Mock<IRuntimeHost> runtimeHost; | ||||
| 		private Mock<IRuntimeWindow> runtimeWindow; | ||||
| 		private Mock<IServiceProxy> service; | ||||
| 		private SessionContext sessionContext; | ||||
| 		private Mock<IRepeatableOperationSequence> sessionSequence; | ||||
| 		private Mock<Action> shutdown; | ||||
| 		private Mock<ISplashScreen> splashScreen; | ||||
| 		private Mock<IText> text; | ||||
| 		private Mock<IUserInterfaceFactory> uiFactory; | ||||
| 
 | ||||
| 		private RuntimeController sut; | ||||
| 
 | ||||
| 		[TestInitialize] | ||||
| 		public void Initialize() | ||||
|  | @ -66,10 +69,12 @@ namespace SafeExamBrowser.Runtime.UnitTests | |||
| 			nextSession = new SessionConfiguration(); | ||||
| 			nextSettings = new AppSettings(); | ||||
| 			runtimeHost = new Mock<IRuntimeHost>(); | ||||
| 			runtimeWindow = new Mock<IRuntimeWindow>(); | ||||
| 			service = new Mock<IServiceProxy>(); | ||||
| 			sessionContext = new SessionContext(); | ||||
| 			sessionSequence = new Mock<IRepeatableOperationSequence>(); | ||||
| 			shutdown = new Mock<Action>(); | ||||
| 			splashScreen = new Mock<ISplashScreen>(); | ||||
| 			text = new Mock<IText>(); | ||||
| 			uiFactory = new Mock<IUserInterfaceFactory>(); | ||||
| 
 | ||||
|  | @ -91,9 +96,11 @@ namespace SafeExamBrowser.Runtime.UnitTests | |||
| 				bootstrapSequence.Object, | ||||
| 				sessionSequence.Object, | ||||
| 				runtimeHost.Object, | ||||
| 				runtimeWindow.Object, | ||||
| 				service.Object, | ||||
| 				sessionContext, | ||||
| 				shutdown.Object, | ||||
| 				splashScreen.Object, | ||||
| 				text.Object, | ||||
| 				uiFactory.Object); | ||||
| 		} | ||||
|  | @ -373,9 +380,6 @@ namespace SafeExamBrowser.Runtime.UnitTests | |||
| 				Progress = true, | ||||
| 				Regress = true | ||||
| 			}; | ||||
| 			var runtimeWindow = new Mock<IRuntimeWindow>(); | ||||
| 
 | ||||
| 			uiFactory.Setup(u => u.CreateRuntimeWindow(It.IsAny<AppConfig>())).Returns(runtimeWindow.Object); | ||||
| 
 | ||||
| 			sut.TryStart(); | ||||
| 			sessionSequence.Raise(o => o.ProgressChanged += null, args); | ||||
|  | @ -391,9 +395,6 @@ namespace SafeExamBrowser.Runtime.UnitTests | |||
| 		public void Operations_MustUpdateStatus() | ||||
| 		{ | ||||
| 			var key = TextKey.OperationStatus_EmptyClipboard; | ||||
| 			var runtimeWindow = new Mock<IRuntimeWindow>(); | ||||
| 
 | ||||
| 			uiFactory.Setup(u => u.CreateRuntimeWindow(It.IsAny<AppConfig>())).Returns(runtimeWindow.Object); | ||||
| 
 | ||||
| 			sut.TryStart(); | ||||
| 			sessionSequence.Raise(o => o.StatusChanged += null, key); | ||||
|  |  | |||
|  | @ -64,14 +64,16 @@ namespace SafeExamBrowser.Runtime | |||
| 			InitializeText(); | ||||
| 
 | ||||
| 			var messageBox = new MessageBox(text); | ||||
| 			var uiFactory = new UserInterfaceFactory(text); | ||||
| 			var desktopFactory = new DesktopFactory(ModuleLogger(nameof(DesktopFactory))); | ||||
| 			var explorerShell = new ExplorerShell(ModuleLogger(nameof(ExplorerShell)), nativeMethods); | ||||
| 			var processFactory = new ProcessFactory(ModuleLogger(nameof(ProcessFactory))); | ||||
| 			var proxyFactory = new ProxyFactory(new ProxyObjectFactory(), ModuleLogger(nameof(ProxyFactory))); | ||||
| 			var runtimeHost = new RuntimeHost(appConfig.RuntimeAddress, new HostObjectFactory(), ModuleLogger(nameof(RuntimeHost)), FIVE_SECONDS); | ||||
| 			var runtimeWindow = uiFactory.CreateRuntimeWindow(appConfig); | ||||
| 			var serviceProxy = new ServiceProxy(appConfig.ServiceAddress, new ProxyObjectFactory(), ModuleLogger(nameof(ServiceProxy)), Interlocutor.Runtime); | ||||
| 			var sessionContext = new SessionContext(); | ||||
| 			var uiFactory = new UserInterfaceFactory(text); | ||||
| 			var splashScreen = uiFactory.CreateSplashScreen(appConfig); | ||||
| 			var userInfo = new UserInfo(ModuleLogger(nameof(UserInfo))); | ||||
| 			var vmDetector = new VirtualMachineDetector(ModuleLogger(nameof(VirtualMachineDetector)), systemInfo); | ||||
| 
 | ||||
|  | @ -100,9 +102,11 @@ namespace SafeExamBrowser.Runtime | |||
| 				bootstrapSequence, | ||||
| 				sessionSequence, | ||||
| 				runtimeHost, | ||||
| 				runtimeWindow, | ||||
| 				serviceProxy, | ||||
| 				sessionContext, | ||||
| 				shutdown, | ||||
| 				splashScreen, | ||||
| 				text, | ||||
| 				uiFactory); | ||||
| 		} | ||||
|  |  | |||
|  | @ -61,9 +61,11 @@ namespace SafeExamBrowser.Runtime | |||
| 			IOperationSequence bootstrapSequence, | ||||
| 			IRepeatableOperationSequence sessionSequence, | ||||
| 			IRuntimeHost runtimeHost, | ||||
| 			IRuntimeWindow runtimeWindow, | ||||
| 			IServiceProxy service, | ||||
| 			SessionContext sessionContext, | ||||
| 			Action shutdown, | ||||
| 			ISplashScreen splashScreen, | ||||
| 			IText text, | ||||
| 			IUserInterfaceFactory uiFactory) | ||||
| 		{ | ||||
|  | @ -72,10 +74,12 @@ namespace SafeExamBrowser.Runtime | |||
| 			this.logger = logger; | ||||
| 			this.messageBox = messageBox; | ||||
| 			this.runtimeHost = runtimeHost; | ||||
| 			this.runtimeWindow = runtimeWindow; | ||||
| 			this.sessionSequence = sessionSequence; | ||||
| 			this.service = service; | ||||
| 			this.sessionContext = sessionContext; | ||||
| 			this.shutdown = shutdown; | ||||
| 			this.splashScreen = splashScreen; | ||||
| 			this.text = text; | ||||
| 			this.uiFactory = uiFactory; | ||||
| 		} | ||||
|  | @ -84,9 +88,6 @@ namespace SafeExamBrowser.Runtime | |||
| 		{ | ||||
| 			logger.Info("Initiating startup procedure..."); | ||||
| 
 | ||||
| 			runtimeWindow = uiFactory.CreateRuntimeWindow(appConfig); | ||||
| 			splashScreen = uiFactory.CreateSplashScreen(appConfig); | ||||
| 
 | ||||
| 			bootstrapSequence.ProgressChanged += BootstrapSequence_ProgressChanged; | ||||
| 			bootstrapSequence.StatusChanged += BootstrapSequence_StatusChanged; | ||||
| 			sessionSequence.ActionRequired += SessionSequence_ActionRequired; | ||||
|  | @ -94,6 +95,7 @@ namespace SafeExamBrowser.Runtime | |||
| 			sessionSequence.StatusChanged += SessionSequence_StatusChanged; | ||||
| 
 | ||||
| 			splashScreen.Show(); | ||||
| 			splashScreen.BringToForeground(); | ||||
| 
 | ||||
| 			var initialized = bootstrapSequence.TryPerform() == OperationResult.Success; | ||||
| 
 | ||||
|  | @ -104,7 +106,7 @@ namespace SafeExamBrowser.Runtime | |||
| 				logger.Info("Application successfully initialized."); | ||||
| 				logger.Log(string.Empty); | ||||
| 				logger.Subscribe(runtimeWindow); | ||||
| 				splashScreen.Close(); | ||||
| 				splashScreen.Hide(); | ||||
| 
 | ||||
| 				StartSession(); | ||||
| 			} | ||||
|  | @ -129,10 +131,10 @@ namespace SafeExamBrowser.Runtime | |||
| 			} | ||||
| 
 | ||||
| 			logger.Unsubscribe(runtimeWindow); | ||||
| 			runtimeWindow?.Close(); | ||||
| 			runtimeWindow.Close(); | ||||
| 
 | ||||
| 			splashScreen = uiFactory.CreateSplashScreen(appConfig); | ||||
| 			splashScreen.Show(); | ||||
| 			splashScreen.BringToForeground(); | ||||
| 
 | ||||
| 			logger.Log(string.Empty); | ||||
| 			logger.Info("Initiating shutdown procedure..."); | ||||
|  | @ -301,7 +303,7 @@ namespace SafeExamBrowser.Runtime | |||
| 
 | ||||
| 		private void BootstrapSequence_StatusChanged(TextKey status) | ||||
| 		{ | ||||
| 			splashScreen?.UpdateStatus(status, true); | ||||
| 			splashScreen.UpdateStatus(status, true); | ||||
| 		} | ||||
| 
 | ||||
| 		private void ClientProcess_Terminated(int exitCode) | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 dbuechel
						dbuechel