From 12f44edc0b8481f50f8d950539e4f670a5485a65 Mon Sep 17 00:00:00 2001 From: dbuechel Date: Wed, 4 Sep 2019 12:07:32 +0200 Subject: [PATCH] SEBWIN-342: Removed unnecessary dependency from system components on I18n. --- .../Operations/BrowserOperationTests.cs | 1 - SafeExamBrowser.Client/CompositionRoot.cs | 2 +- .../SafeExamBrowser.SystemComponents.csproj | 4 ---- .../WirelessNetwork/WirelessAdapter.cs | 5 +---- .../Shell/ISystemControl.cs | 1 - .../Taskbar.xaml.cs | 22 +++++++++---------- .../Taskbar.xaml.cs | 22 +++++++++---------- 7 files changed, 24 insertions(+), 33 deletions(-) diff --git a/SafeExamBrowser.Client.UnitTests/Operations/BrowserOperationTests.cs b/SafeExamBrowser.Client.UnitTests/Operations/BrowserOperationTests.cs index fd333667..4437629b 100644 --- a/SafeExamBrowser.Client.UnitTests/Operations/BrowserOperationTests.cs +++ b/SafeExamBrowser.Client.UnitTests/Operations/BrowserOperationTests.cs @@ -45,7 +45,6 @@ namespace SafeExamBrowser.Client.UnitTests.Operations sut.Perform(); application.Verify(c => c.Initialize(), Times.Once); - // TODO controller.Verify(c => c.RegisterApplicationControl(It.IsAny()), Times.Exactly(2)); actionCenter.Verify(a => a.AddApplicationControl(It.IsAny()), Times.Once); taskbar.Verify(t => t.AddApplicationControl(It.IsAny()), Times.Once); } diff --git a/SafeExamBrowser.Client/CompositionRoot.cs b/SafeExamBrowser.Client/CompositionRoot.cs index c0dd9de2..0f36a9e7 100644 --- a/SafeExamBrowser.Client/CompositionRoot.cs +++ b/SafeExamBrowser.Client/CompositionRoot.cs @@ -264,7 +264,7 @@ namespace SafeExamBrowser.Client var logInfo = new LogNotificationInfo(text); var logController = new LogNotificationController(logger, uiFactory); var powerSupply = new PowerSupply(new ModuleLogger(logger, nameof(PowerSupply))); - var wirelessAdapter = new WirelessAdapter(new ModuleLogger(logger, nameof(WirelessAdapter)), text); + var wirelessAdapter = new WirelessAdapter(new ModuleLogger(logger, nameof(WirelessAdapter))); var activators = new IActionCenterActivator[] { new KeyboardActivator(new ModuleLogger(logger, nameof(KeyboardActivator))), diff --git a/SafeExamBrowser.SystemComponents/SafeExamBrowser.SystemComponents.csproj b/SafeExamBrowser.SystemComponents/SafeExamBrowser.SystemComponents.csproj index 6b69d6cb..7058abac 100644 --- a/SafeExamBrowser.SystemComponents/SafeExamBrowser.SystemComponents.csproj +++ b/SafeExamBrowser.SystemComponents/SafeExamBrowser.SystemComponents.csproj @@ -81,10 +81,6 @@ {7d74555e-63e1-4c46-bd0a-8580552368c8} SafeExamBrowser.Configuration.Contracts - - {1858ddf3-bc2a-4bff-b663-4ce2ffeb8b7d} - SafeExamBrowser.I18n.Contracts - {64ea30fb-11d4-436a-9c2b-88566285363e} SafeExamBrowser.Logging.Contracts diff --git a/SafeExamBrowser.SystemComponents/WirelessNetwork/WirelessAdapter.cs b/SafeExamBrowser.SystemComponents/WirelessNetwork/WirelessAdapter.cs index 0a9bae91..edcb493d 100644 --- a/SafeExamBrowser.SystemComponents/WirelessNetwork/WirelessAdapter.cs +++ b/SafeExamBrowser.SystemComponents/WirelessNetwork/WirelessAdapter.cs @@ -10,7 +10,6 @@ using System; using System.Collections.Generic; using System.Linq; using System.Timers; -using SafeExamBrowser.I18n.Contracts; using SafeExamBrowser.Logging.Contracts; using SafeExamBrowser.SystemComponents.Contracts.WirelessNetwork; using SafeExamBrowser.SystemComponents.Contracts.WirelessNetwork.Events; @@ -26,7 +25,6 @@ namespace SafeExamBrowser.SystemComponents.WirelessNetwork private List networks; private ILogger logger; - private IText text; private Timer timer; private Wifi wifi; @@ -35,11 +33,10 @@ namespace SafeExamBrowser.SystemComponents.WirelessNetwork public event NetworksChangedEventHandler NetworksChanged; public event StatusChangedEventHandler StatusChanged; - public WirelessAdapter(ILogger logger, IText text) + public WirelessAdapter(ILogger logger) { this.logger = logger; this.networks = new List(); - this.text = text; } public void Connect(Guid id) diff --git a/SafeExamBrowser.UserInterface.Contracts/Shell/ISystemControl.cs b/SafeExamBrowser.UserInterface.Contracts/Shell/ISystemControl.cs index 914e1ba2..b474e7e7 100644 --- a/SafeExamBrowser.UserInterface.Contracts/Shell/ISystemControl.cs +++ b/SafeExamBrowser.UserInterface.Contracts/Shell/ISystemControl.cs @@ -13,7 +13,6 @@ namespace SafeExamBrowser.UserInterface.Contracts.Shell /// public interface ISystemControl { - // TODO: Check if needed after all changes! /// /// Closes the control and / or any associated user interface elements. /// diff --git a/SafeExamBrowser.UserInterface.Desktop/Taskbar.xaml.cs b/SafeExamBrowser.UserInterface.Desktop/Taskbar.xaml.cs index bd770fbd..eb69aacd 100644 --- a/SafeExamBrowser.UserInterface.Desktop/Taskbar.xaml.cs +++ b/SafeExamBrowser.UserInterface.Desktop/Taskbar.xaml.cs @@ -125,19 +125,19 @@ namespace SafeExamBrowser.UserInterface.Desktop private void Taskbar_Closing(object sender, CancelEventArgs e) { - if (!allowClose) + if (allowClose) + { + foreach (var child in SystemControlStackPanel.Children) + { + if (child is ISystemControl systemControl) + { + systemControl.Close(); + } + } + } + else { e.Cancel = true; - - return; - } - - foreach (var child in SystemControlStackPanel.Children) - { - if (child is ISystemControl systemControl) - { - systemControl.Close(); - } } } diff --git a/SafeExamBrowser.UserInterface.Mobile/Taskbar.xaml.cs b/SafeExamBrowser.UserInterface.Mobile/Taskbar.xaml.cs index 7c255869..cbe19867 100644 --- a/SafeExamBrowser.UserInterface.Mobile/Taskbar.xaml.cs +++ b/SafeExamBrowser.UserInterface.Mobile/Taskbar.xaml.cs @@ -125,19 +125,19 @@ namespace SafeExamBrowser.UserInterface.Mobile private void Taskbar_Closing(object sender, CancelEventArgs e) { - if (!allowClose) + if (allowClose) + { + foreach (var child in SystemControlStackPanel.Children) + { + if (child is ISystemControl systemControl) + { + systemControl.Close(); + } + } + } + else { e.Cancel = true; - - return; - } - - foreach (var child in SystemControlStackPanel.Children) - { - if (child is ISystemControl systemControl) - { - systemControl.Close(); - } } }