SEBWIN-220: Removed unused dependencies and reverted service-based message box implementation. Need to find solution for message boxes resp. UI interaction from operations in general...

This commit is contained in:
dbuechel 2018-10-02 15:45:45 +02:00
parent c8001e85f6
commit 0b76770f0f
11 changed files with 21 additions and 34 deletions

View file

@ -16,7 +16,6 @@ using SafeExamBrowser.Contracts.Core;
using SafeExamBrowser.Contracts.I18n; using SafeExamBrowser.Contracts.I18n;
using SafeExamBrowser.Contracts.Logging; using SafeExamBrowser.Contracts.Logging;
using SafeExamBrowser.Contracts.UserInterface; using SafeExamBrowser.Contracts.UserInterface;
using SafeExamBrowser.Contracts.UserInterface.MessageBox;
using SafeExamBrowser.Contracts.UserInterface.Taskbar; using SafeExamBrowser.Contracts.UserInterface.Taskbar;
using BrowserSettings = SafeExamBrowser.Contracts.Configuration.Settings.BrowserSettings; using BrowserSettings = SafeExamBrowser.Contracts.Configuration.Settings.BrowserSettings;
@ -30,7 +29,6 @@ namespace SafeExamBrowser.Browser
private IApplicationButton button; private IApplicationButton button;
private IList<IApplicationInstance> instances; private IList<IApplicationInstance> instances;
private IModuleLogger logger; private IModuleLogger logger;
private IMessageBox messageBox;
private BrowserSettings settings; private BrowserSettings settings;
private IText text; private IText text;
private IUserInterfaceFactory uiFactory; private IUserInterfaceFactory uiFactory;
@ -41,14 +39,12 @@ namespace SafeExamBrowser.Browser
AppConfig appConfig, AppConfig appConfig,
BrowserSettings settings, BrowserSettings settings,
IModuleLogger logger, IModuleLogger logger,
IMessageBox messageBox,
IText text, IText text,
IUserInterfaceFactory uiFactory) IUserInterfaceFactory uiFactory)
{ {
this.appConfig = appConfig; this.appConfig = appConfig;
this.instances = new List<IApplicationInstance>(); this.instances = new List<IApplicationInstance>();
this.logger = logger; this.logger = logger;
this.messageBox = messageBox;
this.settings = settings; this.settings = settings;
this.text = text; this.text = text;
this.uiFactory = uiFactory; this.uiFactory = uiFactory;

View file

@ -307,19 +307,17 @@ namespace SafeExamBrowser.Client
private void WindowMonitor_WindowChanged(IntPtr window) private void WindowMonitor_WindowChanged(IntPtr window)
{ {
// TODO! var allowed = processMonitor.BelongsToAllowedProcess(window);
//var allowed = processMonitor.BelongsToAllowedProcess(window); if (!allowed)
{
var success = windowMonitor.Hide(window);
//if (!allowed) if (!success)
//{ {
// var success = windowMonitor.Hide(window); windowMonitor.Close(window);
}
// if (!success) }
// {
// windowMonitor.Close(window);
// }
//}
} }
} }
} }

View file

@ -169,7 +169,7 @@ namespace SafeExamBrowser.Client
private IOperation BuildBrowserOperation() private IOperation BuildBrowserOperation()
{ {
var moduleLogger = new ModuleLogger(logger, "BrowserController"); var moduleLogger = new ModuleLogger(logger, "BrowserController");
var browserController = new BrowserApplicationController(configuration.AppConfig, configuration.Settings.Browser, moduleLogger, messageBox, text, uiFactory); var browserController = new BrowserApplicationController(configuration.AppConfig, configuration.Settings.Browser, moduleLogger, text, uiFactory);
var browserInfo = new BrowserApplicationInfo(); var browserInfo = new BrowserApplicationInfo();
var operation = new BrowserOperation(browserController, browserInfo, logger, Taskbar, uiFactory); var operation = new BrowserOperation(browserController, browserInfo, logger, Taskbar, uiFactory);

View file

@ -37,7 +37,7 @@ namespace SafeExamBrowser.Monitoring.Processes
if (process != null) if (process != null)
{ {
var allowed = process.ProcessName == "SafeExamBrowser"; var allowed = process.ProcessName == "SafeExamBrowser" || process.ProcessName == "SafeExamBrowser.Client";
if (!allowed) if (!allowed)
{ {

View file

@ -59,7 +59,7 @@ namespace SafeExamBrowser.Monitoring.Windows
public void HideAllWindows() public void HideAllWindows()
{ {
logger.Info("Saving windows to be minimized..."); logger.Info("Searching for windows to be minimized...");
foreach (var handle in nativeMethods.GetOpenWindows()) foreach (var handle in nativeMethods.GetOpenWindows())
{ {
@ -70,7 +70,7 @@ namespace SafeExamBrowser.Monitoring.Windows
}; };
minimizedWindows.Add(window); minimizedWindows.Add(window);
logger.Info($"Saved window '{window.Title}' with handle = {window.Handle}."); logger.Info($"Found window '{window.Title}' with handle = {window.Handle}.");
} }
logger.Info("Minimizing all open windows..."); logger.Info("Minimizing all open windows...");

View file

@ -9,11 +9,10 @@
using System; using System;
using Microsoft.VisualStudio.TestTools.UnitTesting; using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq; using Moq;
using SafeExamBrowser.Contracts.Core.OperationModel;
using SafeExamBrowser.Contracts.Communication.Proxies; using SafeExamBrowser.Contracts.Communication.Proxies;
using SafeExamBrowser.Contracts.Configuration; using SafeExamBrowser.Contracts.Configuration;
using SafeExamBrowser.Contracts.Configuration.Settings; using SafeExamBrowser.Contracts.Configuration.Settings;
using SafeExamBrowser.Contracts.I18n; using SafeExamBrowser.Contracts.Core.OperationModel;
using SafeExamBrowser.Contracts.Logging; using SafeExamBrowser.Contracts.Logging;
using SafeExamBrowser.Contracts.UserInterface; using SafeExamBrowser.Contracts.UserInterface;
using SafeExamBrowser.Runtime.Operations; using SafeExamBrowser.Runtime.Operations;
@ -29,7 +28,6 @@ namespace SafeExamBrowser.Runtime.UnitTests.Operations
private Mock<ISessionData> session; private Mock<ISessionData> session;
private Settings settings; private Settings settings;
private Mock<IProgressIndicator> progressIndicator; private Mock<IProgressIndicator> progressIndicator;
private Mock<IText> text;
private ServiceOperation sut; private ServiceOperation sut;
[TestInitialize] [TestInitialize]
@ -41,12 +39,11 @@ namespace SafeExamBrowser.Runtime.UnitTests.Operations
session = new Mock<ISessionData>(); session = new Mock<ISessionData>();
settings = new Settings(); settings = new Settings();
progressIndicator = new Mock<IProgressIndicator>(); progressIndicator = new Mock<IProgressIndicator>();
text = new Mock<IText>();
configuration.SetupGet(c => c.CurrentSession).Returns(session.Object); configuration.SetupGet(c => c.CurrentSession).Returns(session.Object);
configuration.SetupGet(c => c.CurrentSettings).Returns(settings); configuration.SetupGet(c => c.CurrentSettings).Returns(settings);
sut = new ServiceOperation(configuration.Object, logger.Object, service.Object, text.Object); sut = new ServiceOperation(configuration.Object, logger.Object, service.Object);
} }
[TestMethod] [TestMethod]

View file

@ -75,7 +75,7 @@ namespace SafeExamBrowser.Runtime
instances.RuntimeController.Terminate(); instances.RuntimeController.Terminate();
instances.LogShutdownInformation(); instances.LogShutdownInformation();
// TODO: Which UI operation is being cancelled without the timeout? Same problem with client? -> Debug! // TODO: Which UI operation is being cancelled without the timeout? Is this only a debugger issue? Same problem with client? -> Debug!
Thread.Sleep(20); Thread.Sleep(20);
base.Shutdown(); base.Shutdown();

View file

@ -58,7 +58,7 @@ namespace SafeExamBrowser.Runtime.Communication
// TODO: Handle client crash scenario! // TODO: Handle client crash scenario!
// If a client crashes or hangs when terminating (which should not happen!), it could be that it never gets to disconnect from // If a client crashes or hangs when terminating (which should not happen!), it could be that it never gets to disconnect from
// the RuntimeHost - in that case, allowConnection prohibits restarting a new session as long as it's only set here! // the RuntimeHost - in that case, allowConnection prohibits restarting a new session as long as it's only set here!
// -> Move AllowConnection to interface and reset it in SessionController? // -> Move AllowConnection to interface and reset it in RuntimeController?
// -> Only possible as long as just the client connects, with service and client a more elaborate solution will be needed! // -> Only possible as long as just the client connects, with service and client a more elaborate solution will be needed!
// -> E.g. ClientId and ServiceId, and then AllowClientConnection and AllowServiceConnection? // -> E.g. ClientId and ServiceId, and then AllowClientConnection and AllowServiceConnection?
allowConnection = true; allowConnection = true;

View file

@ -73,7 +73,7 @@ namespace SafeExamBrowser.Runtime
sessionOperations.Enqueue(new ConfigurationOperation(appConfig, configuration, logger, messageBox, resourceLoader, runtimeHost, text, uiFactory, args)); sessionOperations.Enqueue(new ConfigurationOperation(appConfig, configuration, logger, messageBox, resourceLoader, runtimeHost, text, uiFactory, args));
sessionOperations.Enqueue(new SessionInitializationOperation(configuration, logger, runtimeHost)); sessionOperations.Enqueue(new SessionInitializationOperation(configuration, logger, runtimeHost));
sessionOperations.Enqueue(new ServiceOperation(configuration, logger, serviceProxy, text)); sessionOperations.Enqueue(new ServiceOperation(configuration, logger, serviceProxy));
sessionOperations.Enqueue(new ClientTerminationOperation(configuration, logger, processFactory, proxyFactory, runtimeHost, FIFTEEN_SECONDS)); sessionOperations.Enqueue(new ClientTerminationOperation(configuration, logger, processFactory, proxyFactory, runtimeHost, FIFTEEN_SECONDS));
sessionOperations.Enqueue(new KioskModeOperation(configuration, desktopFactory, explorerShell, logger, processFactory)); sessionOperations.Enqueue(new KioskModeOperation(configuration, desktopFactory, explorerShell, logger, processFactory));
sessionOperations.Enqueue(new ClientOperation(configuration, logger, processFactory, proxyFactory, runtimeHost, FIFTEEN_SECONDS)); sessionOperations.Enqueue(new ClientOperation(configuration, logger, processFactory, proxyFactory, runtimeHost, FIFTEEN_SECONDS));

View file

@ -6,10 +6,10 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. * file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/ */
using SafeExamBrowser.Contracts.Core.OperationModel;
using SafeExamBrowser.Contracts.Communication.Proxies; using SafeExamBrowser.Contracts.Communication.Proxies;
using SafeExamBrowser.Contracts.Configuration; using SafeExamBrowser.Contracts.Configuration;
using SafeExamBrowser.Contracts.Configuration.Settings; using SafeExamBrowser.Contracts.Configuration.Settings;
using SafeExamBrowser.Contracts.Core.OperationModel;
using SafeExamBrowser.Contracts.I18n; using SafeExamBrowser.Contracts.I18n;
using SafeExamBrowser.Contracts.Logging; using SafeExamBrowser.Contracts.Logging;
using SafeExamBrowser.Contracts.UserInterface; using SafeExamBrowser.Contracts.UserInterface;
@ -22,16 +22,14 @@ namespace SafeExamBrowser.Runtime.Operations
private IConfigurationRepository configuration; private IConfigurationRepository configuration;
private ILogger logger; private ILogger logger;
private IServiceProxy service; private IServiceProxy service;
private IText text;
public IProgressIndicator ProgressIndicator { private get; set; } public IProgressIndicator ProgressIndicator { private get; set; }
public ServiceOperation(IConfigurationRepository configuration, ILogger logger, IServiceProxy service, IText text) public ServiceOperation(IConfigurationRepository configuration, ILogger logger, IServiceProxy service)
{ {
this.configuration = configuration; this.configuration = configuration;
this.service = service; this.service = service;
this.logger = logger; this.logger = logger;
this.text = text;
} }
public OperationResult Perform() public OperationResult Perform()

View file

@ -24,9 +24,7 @@ namespace SafeExamBrowser.UserInterface.Classic
public MessageBoxResult Show(string message, string title, MessageBoxAction action = MessageBoxAction.Confirm, MessageBoxIcon icon = MessageBoxIcon.Information) public MessageBoxResult Show(string message, string title, MessageBoxAction action = MessageBoxAction.Confirm, MessageBoxIcon icon = MessageBoxIcon.Information)
{ {
// The last two parameters are an unfortunate necessity, since e.g. splash screens are displayed topmost while running in their var result = System.Windows.MessageBox.Show(message, title, ToButton(action), ToImage(icon));
// own thread / dispatcher, and would thus conceal the message box...
var result = System.Windows.MessageBox.Show(message, title, ToButton(action), ToImage(icon), System.Windows.MessageBoxResult.None, MessageBoxOptions.ServiceNotification);
return ToResult(result); return ToResult(result);
} }