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:
parent
c8001e85f6
commit
0b76770f0f
11 changed files with 21 additions and 34 deletions
|
@ -16,7 +16,6 @@ using SafeExamBrowser.Contracts.Core;
|
|||
using SafeExamBrowser.Contracts.I18n;
|
||||
using SafeExamBrowser.Contracts.Logging;
|
||||
using SafeExamBrowser.Contracts.UserInterface;
|
||||
using SafeExamBrowser.Contracts.UserInterface.MessageBox;
|
||||
using SafeExamBrowser.Contracts.UserInterface.Taskbar;
|
||||
using BrowserSettings = SafeExamBrowser.Contracts.Configuration.Settings.BrowserSettings;
|
||||
|
||||
|
@ -30,7 +29,6 @@ namespace SafeExamBrowser.Browser
|
|||
private IApplicationButton button;
|
||||
private IList<IApplicationInstance> instances;
|
||||
private IModuleLogger logger;
|
||||
private IMessageBox messageBox;
|
||||
private BrowserSettings settings;
|
||||
private IText text;
|
||||
private IUserInterfaceFactory uiFactory;
|
||||
|
@ -41,14 +39,12 @@ namespace SafeExamBrowser.Browser
|
|||
AppConfig appConfig,
|
||||
BrowserSettings settings,
|
||||
IModuleLogger logger,
|
||||
IMessageBox messageBox,
|
||||
IText text,
|
||||
IUserInterfaceFactory uiFactory)
|
||||
{
|
||||
this.appConfig = appConfig;
|
||||
this.instances = new List<IApplicationInstance>();
|
||||
this.logger = logger;
|
||||
this.messageBox = messageBox;
|
||||
this.settings = settings;
|
||||
this.text = text;
|
||||
this.uiFactory = uiFactory;
|
||||
|
|
|
@ -307,19 +307,17 @@ namespace SafeExamBrowser.Client
|
|||
|
||||
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)
|
||||
//{
|
||||
// var success = windowMonitor.Hide(window);
|
||||
|
||||
// if (!success)
|
||||
// {
|
||||
// windowMonitor.Close(window);
|
||||
// }
|
||||
//}
|
||||
if (!success)
|
||||
{
|
||||
windowMonitor.Close(window);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -169,7 +169,7 @@ namespace SafeExamBrowser.Client
|
|||
private IOperation BuildBrowserOperation()
|
||||
{
|
||||
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 operation = new BrowserOperation(browserController, browserInfo, logger, Taskbar, uiFactory);
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ namespace SafeExamBrowser.Monitoring.Processes
|
|||
|
||||
if (process != null)
|
||||
{
|
||||
var allowed = process.ProcessName == "SafeExamBrowser";
|
||||
var allowed = process.ProcessName == "SafeExamBrowser" || process.ProcessName == "SafeExamBrowser.Client";
|
||||
|
||||
if (!allowed)
|
||||
{
|
||||
|
|
|
@ -59,7 +59,7 @@ namespace SafeExamBrowser.Monitoring.Windows
|
|||
|
||||
public void HideAllWindows()
|
||||
{
|
||||
logger.Info("Saving windows to be minimized...");
|
||||
logger.Info("Searching for windows to be minimized...");
|
||||
|
||||
foreach (var handle in nativeMethods.GetOpenWindows())
|
||||
{
|
||||
|
@ -70,7 +70,7 @@ namespace SafeExamBrowser.Monitoring.Windows
|
|||
};
|
||||
|
||||
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...");
|
||||
|
|
|
@ -9,11 +9,10 @@
|
|||
using System;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Moq;
|
||||
using SafeExamBrowser.Contracts.Core.OperationModel;
|
||||
using SafeExamBrowser.Contracts.Communication.Proxies;
|
||||
using SafeExamBrowser.Contracts.Configuration;
|
||||
using SafeExamBrowser.Contracts.Configuration.Settings;
|
||||
using SafeExamBrowser.Contracts.I18n;
|
||||
using SafeExamBrowser.Contracts.Core.OperationModel;
|
||||
using SafeExamBrowser.Contracts.Logging;
|
||||
using SafeExamBrowser.Contracts.UserInterface;
|
||||
using SafeExamBrowser.Runtime.Operations;
|
||||
|
@ -29,7 +28,6 @@ namespace SafeExamBrowser.Runtime.UnitTests.Operations
|
|||
private Mock<ISessionData> session;
|
||||
private Settings settings;
|
||||
private Mock<IProgressIndicator> progressIndicator;
|
||||
private Mock<IText> text;
|
||||
private ServiceOperation sut;
|
||||
|
||||
[TestInitialize]
|
||||
|
@ -41,12 +39,11 @@ namespace SafeExamBrowser.Runtime.UnitTests.Operations
|
|||
session = new Mock<ISessionData>();
|
||||
settings = new Settings();
|
||||
progressIndicator = new Mock<IProgressIndicator>();
|
||||
text = new Mock<IText>();
|
||||
|
||||
configuration.SetupGet(c => c.CurrentSession).Returns(session.Object);
|
||||
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]
|
||||
|
|
|
@ -75,7 +75,7 @@ namespace SafeExamBrowser.Runtime
|
|||
instances.RuntimeController.Terminate();
|
||||
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);
|
||||
|
||||
base.Shutdown();
|
||||
|
|
|
@ -58,7 +58,7 @@ namespace SafeExamBrowser.Runtime.Communication
|
|||
// 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
|
||||
// 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!
|
||||
// -> E.g. ClientId and ServiceId, and then AllowClientConnection and AllowServiceConnection?
|
||||
allowConnection = true;
|
||||
|
|
|
@ -73,7 +73,7 @@ namespace SafeExamBrowser.Runtime
|
|||
|
||||
sessionOperations.Enqueue(new ConfigurationOperation(appConfig, configuration, logger, messageBox, resourceLoader, runtimeHost, text, uiFactory, args));
|
||||
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 KioskModeOperation(configuration, desktopFactory, explorerShell, logger, processFactory));
|
||||
sessionOperations.Enqueue(new ClientOperation(configuration, logger, processFactory, proxyFactory, runtimeHost, FIFTEEN_SECONDS));
|
||||
|
|
|
@ -6,10 +6,10 @@
|
|||
* 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.Configuration;
|
||||
using SafeExamBrowser.Contracts.Configuration.Settings;
|
||||
using SafeExamBrowser.Contracts.Core.OperationModel;
|
||||
using SafeExamBrowser.Contracts.I18n;
|
||||
using SafeExamBrowser.Contracts.Logging;
|
||||
using SafeExamBrowser.Contracts.UserInterface;
|
||||
|
@ -22,16 +22,14 @@ namespace SafeExamBrowser.Runtime.Operations
|
|||
private IConfigurationRepository configuration;
|
||||
private ILogger logger;
|
||||
private IServiceProxy service;
|
||||
private IText text;
|
||||
|
||||
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.service = service;
|
||||
this.logger = logger;
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
public OperationResult Perform()
|
||||
|
|
|
@ -24,9 +24,7 @@ namespace SafeExamBrowser.UserInterface.Classic
|
|||
|
||||
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
|
||||
// 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);
|
||||
var result = System.Windows.MessageBox.Show(message, title, ToButton(action), ToImage(icon));
|
||||
|
||||
return ToResult(result);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue