SEBWIN-449: Refactored notification implementation, moved icon resources to core library (again) and removed client contracts.

This commit is contained in:
Damian Büchel 2021-03-18 23:12:07 +01:00
parent f92c717e32
commit 48f9344164
73 changed files with 256 additions and 382 deletions
SafeExamBrowser.Applications.Contracts
SafeExamBrowser.Applications
SafeExamBrowser.Browser
SafeExamBrowser.Client.Contracts
SafeExamBrowser.Client.UnitTests
SafeExamBrowser.Client
SafeExamBrowser.Core.Contracts
SafeExamBrowser.Proctoring.Contracts
SafeExamBrowser.Proctoring
SafeExamBrowser.UserInterface.Contracts
SafeExamBrowser.UserInterface.Desktop
SafeExamBrowser.UserInterface.Mobile
SafeExamBrowser.UserInterface.Shared
SafeExamBrowser.sln

View file

@ -6,7 +6,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
using SafeExamBrowser.Applications.Contracts.Resources.Icons;
using SafeExamBrowser.Core.Contracts.Resources.Icons;
namespace SafeExamBrowser.Applications.Contracts.Events
{

View file

@ -9,7 +9,7 @@
using System;
using System.Collections.Generic;
using SafeExamBrowser.Applications.Contracts.Events;
using SafeExamBrowser.Applications.Contracts.Resources.Icons;
using SafeExamBrowser.Core.Contracts.Resources.Icons;
namespace SafeExamBrowser.Applications.Contracts
{

View file

@ -8,7 +8,7 @@
using System;
using SafeExamBrowser.Applications.Contracts.Events;
using SafeExamBrowser.Applications.Contracts.Resources.Icons;
using SafeExamBrowser.Core.Contracts.Resources.Icons;
namespace SafeExamBrowser.Applications.Contracts
{

View file

@ -61,14 +61,13 @@
<Compile Include="IApplication.cs" />
<Compile Include="IApplicationFactory.cs" />
<Compile Include="IApplicationWindow.cs" />
<Compile Include="Resources\Icons\BitmapIconResource.cs" />
<Compile Include="Resources\Icons\EmbeddedIconResource.cs" />
<Compile Include="Resources\Icons\IconResource.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Resources\Icons\NativeIconResource.cs" />
<Compile Include="Resources\Icons\XamlIconResource.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\SafeExamBrowser.Core.Contracts\SafeExamBrowser.Core.Contracts.csproj">
<Project>{fe0e1224-b447-4b14-81e7-ed7d84822aa0}</Project>
<Name>SafeExamBrowser.Core.Contracts</Name>
</ProjectReference>
<ProjectReference Include="..\SafeExamBrowser.Settings\SafeExamBrowser.Settings.csproj">
<Project>{30b2d907-5861-4f39-abad-c4abf1b3470e}</Project>
<Name>SafeExamBrowser.Settings</Name>

View file

@ -11,7 +11,7 @@ using System.Collections.Generic;
using System.Linq;
using SafeExamBrowser.Applications.Contracts;
using SafeExamBrowser.Applications.Contracts.Events;
using SafeExamBrowser.Applications.Contracts.Resources.Icons;
using SafeExamBrowser.Core.Contracts.Resources.Icons;
using SafeExamBrowser.Logging.Contracts;
using SafeExamBrowser.Monitoring.Contracts.Applications;
using SafeExamBrowser.Settings.Applications;

View file

@ -12,7 +12,7 @@ using System.Linq;
using System.Timers;
using SafeExamBrowser.Applications.Contracts;
using SafeExamBrowser.Applications.Contracts.Events;
using SafeExamBrowser.Applications.Contracts.Resources.Icons;
using SafeExamBrowser.Core.Contracts.Resources.Icons;
using SafeExamBrowser.Applications.Events;
using SafeExamBrowser.Logging.Contracts;
using SafeExamBrowser.WindowsApi.Contracts;

View file

@ -9,7 +9,7 @@
using System;
using SafeExamBrowser.Applications.Contracts;
using SafeExamBrowser.Applications.Contracts.Events;
using SafeExamBrowser.Applications.Contracts.Resources.Icons;
using SafeExamBrowser.Core.Contracts.Resources.Icons;
using SafeExamBrowser.WindowsApi.Contracts;
namespace SafeExamBrowser.Applications

View file

@ -66,6 +66,10 @@
<Project>{ac77745d-3b41-43e2-8e84-d40e5a4ee77f}</Project>
<Name>SafeExamBrowser.Applications.Contracts</Name>
</ProjectReference>
<ProjectReference Include="..\SafeExamBrowser.Core.Contracts\SafeExamBrowser.Core.Contracts.csproj">
<Project>{fe0e1224-b447-4b14-81e7-ed7d84822aa0}</Project>
<Name>SafeExamBrowser.Core.Contracts</Name>
</ProjectReference>
<ProjectReference Include="..\SafeExamBrowser.Logging.Contracts\SafeExamBrowser.Logging.Contracts.csproj">
<Project>{64ea30fb-11d4-436a-9c2b-88566285363e}</Project>
<Name>SafeExamBrowser.Logging.Contracts</Name>

View file

@ -14,7 +14,7 @@ using CefSharp;
using CefSharp.WinForms;
using SafeExamBrowser.Applications.Contracts;
using SafeExamBrowser.Applications.Contracts.Events;
using SafeExamBrowser.Applications.Contracts.Resources.Icons;
using SafeExamBrowser.Core.Contracts.Resources.Icons;
using SafeExamBrowser.Browser.Contracts;
using SafeExamBrowser.Browser.Contracts.Events;
using SafeExamBrowser.Browser.Events;

View file

@ -12,7 +12,7 @@ using System.Threading.Tasks;
using CefSharp;
using SafeExamBrowser.Applications.Contracts;
using SafeExamBrowser.Applications.Contracts.Events;
using SafeExamBrowser.Applications.Contracts.Resources.Icons;
using SafeExamBrowser.Core.Contracts.Resources.Icons;
using SafeExamBrowser.Browser.Contracts.Events;
using SafeExamBrowser.Browser.Contracts.Filters;
using SafeExamBrowser.Browser.Events;

View file

@ -7,7 +7,7 @@
*/
using System;
using SafeExamBrowser.Applications.Contracts.Resources.Icons;
using SafeExamBrowser.Core.Contracts.Resources.Icons;
namespace SafeExamBrowser.Browser
{

View file

@ -122,6 +122,10 @@
<Project>{7d74555e-63e1-4c46-bd0a-8580552368c8}</Project>
<Name>SafeExamBrowser.Configuration.Contracts</Name>
</ProjectReference>
<ProjectReference Include="..\SafeExamBrowser.Core.Contracts\SafeExamBrowser.Core.Contracts.csproj">
<Project>{fe0e1224-b447-4b14-81e7-ed7d84822aa0}</Project>
<Name>SafeExamBrowser.Core.Contracts</Name>
</ProjectReference>
<ProjectReference Include="..\SafeExamBrowser.I18n.Contracts\SafeExamBrowser.I18n.Contracts.csproj">
<Project>{1858ddf3-bc2a-4bff-b663-4ce2ffeb8b7d}</Project>
<Name>SafeExamBrowser.I18n.Contracts</Name>

View file

@ -1,28 +0,0 @@
/*
* Copyright (c) 2021 ETH Zürich, Educational Development and Technology (LET)
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
using SafeExamBrowser.Applications.Contracts.Resources.Icons;
namespace SafeExamBrowser.Client.Contracts
{
/// <summary>
/// The information about a notification.
/// </summary>
public interface INotificationInfo
{
/// <summary>
/// The tooltip for the notification.
/// </summary>
string Tooltip { get; }
/// <summary>
/// The resource providing the notification icon.
/// </summary>
IconResource IconResource { get; }
}
}

View file

@ -1,33 +0,0 @@
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("SafeExamBrowser.Client.Contracts")]
[assembly: AssemblyDescription("Safe Exam Browser")]
[assembly: AssemblyCompany("ETH Zürich")]
[assembly: AssemblyProduct("SafeExamBrowser.Client.Contracts")]
[assembly: AssemblyCopyright("Copyright © 2021 ETH Zürich, Educational Development and Technology (LET)")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("d39aea14-9d5e-404d-be39-a552e1bd2c7d")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0.0")]

View file

@ -1,72 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{D39AEA14-9D5E-404D-BE39-A552E1BD2C7D}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>SafeExamBrowser.Client.Contracts</RootNamespace>
<AssemblyName>SafeExamBrowser.Client.Contracts</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="Microsoft.CSharp" />
</ItemGroup>
<ItemGroup>
<Compile Include="INotificationController.cs" />
<Compile Include="INotificationInfo.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\SafeExamBrowser.Applications.Contracts\SafeExamBrowser.Applications.Contracts.csproj">
<Project>{ac77745d-3b41-43e2-8e84-d40e5a4ee77f}</Project>
<Name>SafeExamBrowser.Applications.Contracts</Name>
</ProjectReference>
<ProjectReference Include="..\SafeExamBrowser.Core.Contracts\SafeExamBrowser.Core.Contracts.csproj">
<Project>{fe0e1224-b447-4b14-81e7-ed7d84822aa0}</Project>
<Name>SafeExamBrowser.Core.Contracts</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View file

@ -10,6 +10,7 @@ using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
using SafeExamBrowser.Client.Notifications;
using SafeExamBrowser.Configuration.Contracts;
using SafeExamBrowser.I18n.Contracts;
using SafeExamBrowser.UserInterface.Contracts;
using SafeExamBrowser.UserInterface.Contracts.Windows;
@ -19,12 +20,14 @@ namespace SafeExamBrowser.Client.UnitTests.Notifications
public class AboutNotificationControllerTests
{
private Mock<AppConfig> appConfig;
private Mock<IText> text;
private Mock<IUserInterfaceFactory> uiFactory;
[TestInitialize]
public void Initialize()
{
appConfig = new Mock<AppConfig>();
text = new Mock<IText>();
uiFactory = new Mock<IUserInterfaceFactory>();
}
@ -32,7 +35,7 @@ namespace SafeExamBrowser.Client.UnitTests.Notifications
public void MustCloseWindowWhenTerminating()
{
var window = new Mock<IWindow>();
var sut = new AboutNotificationController(appConfig.Object, uiFactory.Object);
var sut = new AboutNotification(appConfig.Object, text.Object, uiFactory.Object);
uiFactory.Setup(u => u.CreateAboutWindow(It.IsAny<AppConfig>())).Returns(window.Object);
@ -46,7 +49,7 @@ namespace SafeExamBrowser.Client.UnitTests.Notifications
public void MustOpenOnlyOneWindow()
{
var window = new Mock<IWindow>();
var sut = new AboutNotificationController(appConfig.Object, uiFactory.Object);
var sut = new AboutNotification(appConfig.Object, text.Object, uiFactory.Object);
uiFactory.Setup(u => u.CreateAboutWindow(It.IsAny<AppConfig>())).Returns(window.Object);
@ -64,7 +67,7 @@ namespace SafeExamBrowser.Client.UnitTests.Notifications
[TestMethod]
public void MustNotFailToTerminateIfNotStarted()
{
var sut = new AboutNotificationController(appConfig.Object, uiFactory.Object);
var sut = new AboutNotification(appConfig.Object, text.Object, uiFactory.Object);
sut.Terminate();
}

View file

@ -9,6 +9,7 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
using SafeExamBrowser.Client.Notifications;
using SafeExamBrowser.I18n.Contracts;
using SafeExamBrowser.Logging.Contracts;
using SafeExamBrowser.UserInterface.Contracts;
using SafeExamBrowser.UserInterface.Contracts.Windows;
@ -19,12 +20,14 @@ namespace SafeExamBrowser.Client.UnitTests.Notifications
public class LogNotificationControllerTests
{
private Mock<ILogger> logger;
private Mock<IText> text;
private Mock<IUserInterfaceFactory> uiFactory;
[TestInitialize]
public void Initialize()
{
logger = new Mock<ILogger>();
text = new Mock<IText>();
uiFactory = new Mock<IUserInterfaceFactory>();
}
@ -32,7 +35,7 @@ namespace SafeExamBrowser.Client.UnitTests.Notifications
public void MustCloseWindowWhenTerminating()
{
var window = new Mock<IWindow>();
var sut = new LogNotificationController(logger.Object, uiFactory.Object);
var sut = new LogNotification(logger.Object, text.Object, uiFactory.Object);
uiFactory.Setup(u => u.CreateLogWindow(It.IsAny<ILogger>())).Returns(window.Object);
@ -46,7 +49,7 @@ namespace SafeExamBrowser.Client.UnitTests.Notifications
public void MustOpenOnlyOneWindow()
{
var window = new Mock<IWindow>();
var sut = new LogNotificationController(logger.Object, uiFactory.Object);
var sut = new LogNotification(logger.Object, text.Object, uiFactory.Object);
uiFactory.Setup(u => u.CreateLogWindow(It.IsAny<ILogger>())).Returns(window.Object);
@ -64,7 +67,7 @@ namespace SafeExamBrowser.Client.UnitTests.Notifications
[TestMethod]
public void MustNotFailToTerminateIfNotStarted()
{
var sut = new LogNotificationController(logger.Object, uiFactory.Object);
var sut = new LogNotification(logger.Object, text.Object, uiFactory.Object);
sut.Terminate();
}

View file

@ -9,8 +9,8 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
using SafeExamBrowser.Applications.Contracts;
using SafeExamBrowser.Client.Contracts;
using SafeExamBrowser.Client.Operations;
using SafeExamBrowser.Core.Contracts.Notifications;
using SafeExamBrowser.I18n.Contracts;
using SafeExamBrowser.Logging.Contracts;
using SafeExamBrowser.Settings;
@ -32,11 +32,9 @@ namespace SafeExamBrowser.Client.UnitTests.Operations
private Mock<IAudio> audio;
private ClientContext context;
private Mock<ILogger> logger;
private Mock<INotificationInfo> aboutInfo;
private Mock<INotificationController> aboutController;
private Mock<INotification> aboutNotification;
private Mock<IKeyboard> keyboard;
private Mock<INotificationInfo> logInfo;
private Mock<INotificationController> logController;
private Mock<INotification> logNotification;
private Mock<IPowerSupply> powerSupply;
private Mock<ISystemInfo> systemInfo;
private Mock<ITaskbar> taskbar;
@ -54,11 +52,9 @@ namespace SafeExamBrowser.Client.UnitTests.Operations
audio = new Mock<IAudio>();
context = new ClientContext();
logger = new Mock<ILogger>();
aboutInfo = new Mock<INotificationInfo>();
aboutController = new Mock<INotificationController>();
aboutNotification = new Mock<INotification>();
keyboard = new Mock<IKeyboard>();
logInfo = new Mock<INotificationInfo>();
logController = new Mock<INotificationController>();
logNotification = new Mock<INotification>();
powerSupply = new Mock<IPowerSupply>();
systemInfo = new Mock<ISystemInfo>();
taskbar = new Mock<ITaskbar>();
@ -70,19 +66,17 @@ namespace SafeExamBrowser.Client.UnitTests.Operations
context.Settings = new AppSettings();
uiFactory
.Setup(u => u.CreateNotificationControl(It.IsAny<INotificationController>(), It.IsAny<INotificationInfo>(), It.IsAny<Location>()))
.Setup(u => u.CreateNotificationControl(It.IsAny<INotification>(), It.IsAny<Location>()))
.Returns(new Mock<INotificationControl>().Object);
sut = new ShellOperation(
actionCenter.Object,
audio.Object,
aboutInfo.Object,
aboutController.Object,
aboutNotification.Object,
context,
keyboard.Object,
logger.Object,
logInfo.Object,
logController.Object,
logNotification.Object,
powerSupply.Object,
systemInfo.Object,
taskbar.Object,
@ -272,7 +266,7 @@ namespace SafeExamBrowser.Client.UnitTests.Operations
context.Settings.Taskbar.ShowApplicationLog = false;
uiFactory
.Setup(f => f.CreateNotificationControl(It.IsAny<INotificationController>(), It.Is<INotificationInfo>(i => i == logInfo.Object), It.IsAny<Location>()))
.Setup(f => f.CreateNotificationControl(It.IsAny<INotification>(), It.IsAny<Location>()))
.Returns(logControl.Object);
sut.Perform();
@ -409,9 +403,9 @@ namespace SafeExamBrowser.Client.UnitTests.Operations
{
sut.Revert();
aboutController.Verify(c => c.Terminate(), Times.Once);
aboutNotification.Verify(c => c.Terminate(), Times.Once);
audio.Verify(a => a.Terminate(), Times.Once);
logController.Verify(c => c.Terminate(), Times.Once);
logNotification.Verify(c => c.Terminate(), Times.Once);
powerSupply.Verify(p => p.Terminate(), Times.Once);
keyboard.Verify(k => k.Terminate(), Times.Once);
wirelessAdapter.Verify(w => w.Terminate(), Times.Once);

View file

@ -116,10 +116,6 @@
<Project>{5fb5273d-277c-41dd-8593-a25ce1aff2e9}</Project>
<Name>SafeExamBrowser.Browser.Contracts</Name>
</ProjectReference>
<ProjectReference Include="..\SafeExamBrowser.Client.Contracts\SafeExamBrowser.Client.Contracts.csproj">
<Project>{d39aea14-9d5e-404d-be39-a552e1bd2c7d}</Project>
<Name>SafeExamBrowser.Client.Contracts</Name>
</ProjectReference>
<ProjectReference Include="..\SafeExamBrowser.Client\SafeExamBrowser.Client.csproj">
<Project>{7CC5A895-E0D3-4E43-9B39-CCEC05A5A6A7}</Project>
<Name>SafeExamBrowser.Client</Name>

View file

@ -250,7 +250,7 @@ namespace SafeExamBrowser.Client
private IOperation BuildProctoringOperation()
{
var controller = new ProctoringController(context.AppConfig, new FileSystem(), ModuleLogger(nameof(ProctoringController)), uiFactory);
var operation = new ProctoringOperation(context, logger, controller);
var operation = new ProctoringOperation(actionCenter, context, controller, logger, controller, taskbar, uiFactory);
context.ProctoringController = controller;
@ -269,22 +269,18 @@ namespace SafeExamBrowser.Client
private IOperation BuildShellOperation()
{
var aboutInfo = new AboutNotificationInfo(text);
var aboutController = new AboutNotificationController(context.AppConfig, uiFactory);
var aboutNotification = new AboutNotification(context.AppConfig, text, uiFactory);
var audio = new Audio(context.Settings.Audio, ModuleLogger(nameof(Audio)));
var keyboard = new Keyboard(ModuleLogger(nameof(Keyboard)));
var logInfo = new LogNotificationInfo(text);
var logController = new LogNotificationController(logger, uiFactory);
var logNotification = new LogNotification(logger, text, uiFactory);
var operation = new ShellOperation(
actionCenter,
audio,
aboutInfo,
aboutController,
aboutNotification,
context,
keyboard,
logger,
logInfo,
logController,
logNotification,
powerSupply,
systemInfo,
taskbar,

View file

@ -6,23 +6,35 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
using SafeExamBrowser.Client.Contracts;
using System;
using SafeExamBrowser.Configuration.Contracts;
using SafeExamBrowser.Core.Contracts.Notifications;
using SafeExamBrowser.Core.Contracts.Resources.Icons;
using SafeExamBrowser.I18n.Contracts;
using SafeExamBrowser.UserInterface.Contracts;
using SafeExamBrowser.UserInterface.Contracts.Windows;
namespace SafeExamBrowser.Client.Notifications
{
internal class AboutNotificationController : INotificationController
internal class AboutNotification : INotification
{
private AppConfig appConfig;
private IUserInterfaceFactory uiFactory;
private readonly AppConfig appConfig;
private readonly IText text;
private readonly IUserInterfaceFactory uiFactory;
private IWindow window;
public AboutNotificationController(AppConfig appConfig, IUserInterfaceFactory uiFactory)
public string Tooltip { get; }
public IconResource IconResource { get; }
public AboutNotification(AppConfig appConfig, IText text, IUserInterfaceFactory uiFactory)
{
this.appConfig = appConfig;
this.text = text;
this.uiFactory = uiFactory;
IconResource = new XamlIconResource { Uri = new Uri("pack://application:,,,/SafeExamBrowser.UserInterface.Desktop;component/Images/AboutNotification.xaml") };
Tooltip = text.Get(TextKey.Notification_AboutTooltip);
}
public void Activate()

View file

@ -1,27 +0,0 @@
/*
* Copyright (c) 2021 ETH Zürich, Educational Development and Technology (LET)
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
using System;
using SafeExamBrowser.Applications.Contracts.Resources.Icons;
using SafeExamBrowser.Client.Contracts;
using SafeExamBrowser.I18n.Contracts;
namespace SafeExamBrowser.Client.Notifications
{
internal class AboutNotificationInfo : INotificationInfo
{
public string Tooltip { get; }
public IconResource IconResource { get; }
public AboutNotificationInfo(IText text)
{
IconResource = new XamlIconResource { Uri = new Uri("pack://application:,,,/SafeExamBrowser.UserInterface.Desktop;component/Images/AboutNotification.xaml") };
Tooltip = text.Get(TextKey.Notification_AboutTooltip);
}
}
}

View file

@ -6,23 +6,35 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
using SafeExamBrowser.Client.Contracts;
using System;
using SafeExamBrowser.Core.Contracts.Notifications;
using SafeExamBrowser.Core.Contracts.Resources.Icons;
using SafeExamBrowser.I18n.Contracts;
using SafeExamBrowser.Logging.Contracts;
using SafeExamBrowser.UserInterface.Contracts;
using SafeExamBrowser.UserInterface.Contracts.Windows;
namespace SafeExamBrowser.Client.Notifications
{
internal class LogNotificationController : INotificationController
internal class LogNotification : INotification
{
private ILogger logger;
private IUserInterfaceFactory uiFactory;
private readonly ILogger logger;
private readonly IText text;
private readonly IUserInterfaceFactory uiFactory;
private IWindow window;
public LogNotificationController(ILogger logger, IUserInterfaceFactory uiFactory)
public string Tooltip { get; }
public IconResource IconResource { get; }
public LogNotification(ILogger logger, IText text, IUserInterfaceFactory uiFactory)
{
this.logger = logger;
this.text = text;
this.uiFactory = uiFactory;
IconResource = new BitmapIconResource { Uri = new Uri("pack://application:,,,/SafeExamBrowser.UserInterface.Desktop;component/Images/LogNotification.ico") };
Tooltip = text.Get(TextKey.Notification_LogTooltip);
}
public void Activate()

View file

@ -1,27 +0,0 @@
/*
* Copyright (c) 2021 ETH Zürich, Educational Development and Technology (LET)
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
using System;
using SafeExamBrowser.Applications.Contracts.Resources.Icons;
using SafeExamBrowser.Client.Contracts;
using SafeExamBrowser.I18n.Contracts;
namespace SafeExamBrowser.Client.Notifications
{
internal class LogNotificationInfo : INotificationInfo
{
public string Tooltip { get; }
public IconResource IconResource { get; }
public LogNotificationInfo(IText text)
{
IconResource = new BitmapIconResource { Uri = new Uri("pack://application:,,,/SafeExamBrowser.UserInterface.Desktop;component/Images/LogNotification.ico") };
Tooltip = text.Get(TextKey.Notification_LogTooltip);
}
}
}

View file

@ -6,26 +6,44 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
using SafeExamBrowser.Core.Contracts.Notifications;
using SafeExamBrowser.Core.Contracts.OperationModel;
using SafeExamBrowser.Core.Contracts.OperationModel.Events;
using SafeExamBrowser.I18n.Contracts;
using SafeExamBrowser.Logging.Contracts;
using SafeExamBrowser.Proctoring.Contracts;
using SafeExamBrowser.UserInterface.Contracts;
using SafeExamBrowser.UserInterface.Contracts.Shell;
namespace SafeExamBrowser.Client.Operations
{
internal class ProctoringOperation : ClientOperation
{
private readonly ILogger logger;
private readonly IActionCenter actionCenter;
private readonly IProctoringController controller;
private readonly ILogger logger;
private readonly INotification notification;
private readonly ITaskbar taskbar;
private readonly IUserInterfaceFactory uiFactory;
public override event ActionRequiredEventHandler ActionRequired { add { } remove { } }
public override event StatusChangedEventHandler StatusChanged;
public ProctoringOperation(ClientContext context, ILogger logger, IProctoringController controller) : base(context)
public ProctoringOperation(
IActionCenter actionCenter,
ClientContext context,
IProctoringController controller,
ILogger logger,
INotification notification,
ITaskbar taskbar,
IUserInterfaceFactory uiFactory) : base(context)
{
this.actionCenter = actionCenter;
this.controller = controller;
this.logger = logger;
this.notification = notification;
this.taskbar = taskbar;
this.uiFactory = uiFactory;
}
public override OperationResult Perform()
@ -35,7 +53,13 @@ namespace SafeExamBrowser.Client.Operations
logger.Info("Initializing proctoring...");
StatusChanged?.Invoke(TextKey.OperationStatus_InitializeProctoring);
var actionCenterControl = uiFactory.CreateNotificationControl(notification, Location.ActionCenter);
var taskbarControl = uiFactory.CreateNotificationControl(notification, Location.Taskbar);
controller.Initialize(Context.Settings.Proctoring);
actionCenter.AddNotificationControl(actionCenterControl);
taskbar.AddNotificationControl(taskbarControl);
}
return OperationResult.Success;
@ -49,6 +73,7 @@ namespace SafeExamBrowser.Client.Operations
StatusChanged?.Invoke(TextKey.OperationStatus_TerminateProctoring);
controller.Terminate();
notification.Terminate();
}
return OperationResult.Success;

View file

@ -7,7 +7,7 @@
*/
using System.Linq;
using SafeExamBrowser.Client.Contracts;
using SafeExamBrowser.Core.Contracts.Notifications;
using SafeExamBrowser.Core.Contracts.OperationModel;
using SafeExamBrowser.Core.Contracts.OperationModel.Events;
using SafeExamBrowser.I18n.Contracts;
@ -26,12 +26,10 @@ namespace SafeExamBrowser.Client.Operations
{
private IActionCenter actionCenter;
private IAudio audio;
private INotificationInfo aboutInfo;
private INotificationController aboutController;
private INotification aboutNotification;
private IKeyboard keyboard;
private ILogger logger;
private INotificationInfo logInfo;
private INotificationController logController;
private INotification logNotification;
private IPowerSupply powerSupply;
private ISystemInfo systemInfo;
private ITaskbar taskbar;
@ -46,13 +44,11 @@ namespace SafeExamBrowser.Client.Operations
public ShellOperation(
IActionCenter actionCenter,
IAudio audio,
INotificationInfo aboutInfo,
INotificationController aboutController,
INotification aboutNotification,
ClientContext context,
IKeyboard keyboard,
ILogger logger,
INotificationInfo logInfo,
INotificationController logController,
INotification logNotification,
IPowerSupply powerSupply,
ISystemInfo systemInfo,
ITaskbar taskbar,
@ -61,14 +57,12 @@ namespace SafeExamBrowser.Client.Operations
IUserInterfaceFactory uiFactory,
IWirelessAdapter wirelessAdapter) : base(context)
{
this.aboutInfo = aboutInfo;
this.aboutController = aboutController;
this.aboutNotification = aboutNotification;
this.actionCenter = actionCenter;
this.audio = audio;
this.keyboard = keyboard;
this.logger = logger;
this.logInfo = logInfo;
this.logController = logController;
this.logNotification = logNotification;
this.powerSupply = powerSupply;
this.systemInfo = systemInfo;
this.text = text;
@ -218,7 +212,7 @@ namespace SafeExamBrowser.Client.Operations
{
if (Context.Settings.ActionCenter.ShowApplicationInfo)
{
actionCenter.AddNotificationControl(uiFactory.CreateNotificationControl(aboutController, aboutInfo, Location.ActionCenter));
actionCenter.AddNotificationControl(uiFactory.CreateNotificationControl(aboutNotification, Location.ActionCenter));
}
}
@ -226,7 +220,7 @@ namespace SafeExamBrowser.Client.Operations
{
if (Context.Settings.Taskbar.ShowApplicationInfo)
{
taskbar.AddNotificationControl(uiFactory.CreateNotificationControl(aboutController, aboutInfo, Location.Taskbar));
taskbar.AddNotificationControl(uiFactory.CreateNotificationControl(aboutNotification, Location.Taskbar));
}
}
@ -260,7 +254,7 @@ namespace SafeExamBrowser.Client.Operations
{
if (Context.Settings.ActionCenter.ShowApplicationLog)
{
actionCenter.AddNotificationControl(uiFactory.CreateNotificationControl(logController, logInfo, Location.ActionCenter));
actionCenter.AddNotificationControl(uiFactory.CreateNotificationControl(logNotification, Location.ActionCenter));
}
}
@ -268,7 +262,7 @@ namespace SafeExamBrowser.Client.Operations
{
if (Context.Settings.Taskbar.ShowApplicationLog)
{
taskbar.AddNotificationControl(uiFactory.CreateNotificationControl(logController, logInfo, Location.Taskbar));
taskbar.AddNotificationControl(uiFactory.CreateNotificationControl(logNotification, Location.Taskbar));
}
}
@ -340,8 +334,8 @@ namespace SafeExamBrowser.Client.Operations
private void TerminateNotifications()
{
aboutController.Terminate();
logController.Terminate();
aboutNotification.Terminate();
logNotification.Terminate();
}
private void TerminateSystemComponents()

View file

@ -85,10 +85,8 @@
<Compile Include="Operations\RuntimeConnectionOperation.cs" />
<Compile Include="Communication\ClientHost.cs" />
<Compile Include="CompositionRoot.cs" />
<Compile Include="Notifications\AboutNotificationController.cs" />
<Compile Include="Notifications\AboutNotificationInfo.cs" />
<Compile Include="Notifications\LogNotificationController.cs" />
<Compile Include="Notifications\LogNotificationInfo.cs" />
<Compile Include="Notifications\AboutNotification.cs" />
<Compile Include="Notifications\LogNotification.cs" />
<Compile Include="Operations\BrowserOperation.cs" />
<Compile Include="Operations\ClipboardOperation.cs" />
<Compile Include="Operations\DisplayMonitorOperation.cs" />
@ -143,10 +141,6 @@
<Project>{04E653F1-98E6-4E34-9DD7-7F2BC1A8B767}</Project>
<Name>SafeExamBrowser.Browser</Name>
</ProjectReference>
<ProjectReference Include="..\SafeExamBrowser.Client.Contracts\SafeExamBrowser.Client.Contracts.csproj">
<Project>{d39aea14-9d5e-404d-be39-a552e1bd2c7d}</Project>
<Name>SafeExamBrowser.Client.Contracts</Name>
</ProjectReference>
<ProjectReference Include="..\SafeExamBrowser.Communication.Contracts\SafeExamBrowser.Communication.Contracts.csproj">
<Project>{0cd2c5fe-711a-4c32-afe0-bb804fe8b220}</Project>
<Name>SafeExamBrowser.Communication.Contracts</Name>

View file

@ -6,20 +6,32 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
namespace SafeExamBrowser.Client.Contracts
using SafeExamBrowser.Core.Contracts.Resources.Icons;
namespace SafeExamBrowser.Core.Contracts.Notifications
{
/// <summary>
/// Controls the lifetime and functionality of a notification which can be activated via the UI.
/// </summary>
public interface INotificationController
public interface INotification
{
/// <summary>
/// The tooltip for the notification.
/// </summary>
string Tooltip { get; }
/// <summary>
/// The resource providing the notification icon.
/// </summary>
IconResource IconResource { get; }
/// <summary>
/// Executes the notification functionality.
/// </summary>
void Activate();
/// <summary>
/// Instructs the controller to shut down and release all used resources.
/// Terminates the notification functionality and release all used resources.
/// </summary>
void Terminate();
}

View file

@ -8,7 +8,7 @@
using System;
namespace SafeExamBrowser.Applications.Contracts.Resources.Icons
namespace SafeExamBrowser.Core.Contracts.Resources.Icons
{
/// <summary>
/// Defines an icon resource which is a bitmap image (i.e. raster graphics).

View file

@ -6,7 +6,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
namespace SafeExamBrowser.Applications.Contracts.Resources.Icons
namespace SafeExamBrowser.Core.Contracts.Resources.Icons
{
/// <summary>
/// Defines an icon resource which is a file with embedded icon data (e.g. an executable).

View file

@ -6,7 +6,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
namespace SafeExamBrowser.Applications.Contracts.Resources.Icons
namespace SafeExamBrowser.Core.Contracts.Resources.Icons
{
/// <summary>
/// Defines an icon resource.

View file

@ -8,7 +8,7 @@
using System;
namespace SafeExamBrowser.Applications.Contracts.Resources.Icons
namespace SafeExamBrowser.Core.Contracts.Resources.Icons
{
/// <summary>
/// Defines an icon resource which is managed by the operating system.

View file

@ -8,7 +8,7 @@
using System;
namespace SafeExamBrowser.Applications.Contracts.Resources.Icons
namespace SafeExamBrowser.Core.Contracts.Resources.Icons
{
/// <summary>
/// Defines an icon resource which consists of XAML markup (i.e. vector graphics).

View file

@ -54,6 +54,7 @@
<Reference Include="Microsoft.CSharp" />
</ItemGroup>
<ItemGroup>
<Compile Include="Notifications\INotification.cs" />
<Compile Include="OperationModel\Events\ActionRequiredEventArgs.cs" />
<Compile Include="OperationModel\Events\ActionRequiredEventHandler.cs" />
<Compile Include="OperationModel\Events\ProgressChangedEventArgs.cs" />
@ -65,6 +66,11 @@
<Compile Include="OperationModel\IRepeatableOperationSequence.cs" />
<Compile Include="OperationModel\OperationResult.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Resources\Icons\BitmapIconResource.cs" />
<Compile Include="Resources\Icons\EmbeddedIconResource.cs" />
<Compile Include="Resources\Icons\IconResource.cs" />
<Compile Include="Resources\Icons\NativeIconResource.cs" />
<Compile Include="Resources\Icons\XamlIconResource.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\SafeExamBrowser.I18n.Contracts\SafeExamBrowser.I18n.Contracts.csproj">

View file

@ -58,6 +58,10 @@
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\SafeExamBrowser.Core.Contracts\SafeExamBrowser.Core.Contracts.csproj">
<Project>{fe0e1224-b447-4b14-81e7-ed7d84822aa0}</Project>
<Name>SafeExamBrowser.Core.Contracts</Name>
</ProjectReference>
<ProjectReference Include="..\SafeExamBrowser.Settings\SafeExamBrowser.Settings.csproj">
<Project>{30b2d907-5861-4f39-abad-c4abf1b3470e}</Project>
<Name>SafeExamBrowser.Settings</Name>

View file

@ -10,6 +10,8 @@ using System;
using System.IO;
using System.Reflection;
using SafeExamBrowser.Configuration.Contracts;
using SafeExamBrowser.Core.Contracts.Notifications;
using SafeExamBrowser.Core.Contracts.Resources.Icons;
using SafeExamBrowser.Logging.Contracts;
using SafeExamBrowser.Proctoring.Contracts;
using SafeExamBrowser.Settings.Proctoring;
@ -19,7 +21,7 @@ using SafeExamBrowser.UserInterface.Contracts.Proctoring;
namespace SafeExamBrowser.Proctoring
{
public class ProctoringController : IProctoringController
public class ProctoringController : IProctoringController, INotification
{
private readonly AppConfig appConfig;
private readonly IFileSystem fileSystem;
@ -29,6 +31,9 @@ namespace SafeExamBrowser.Proctoring
private string filePath;
private IProctoringWindow window;
public string Tooltip => "TODO!!!";
public IconResource IconResource => new XamlIconResource();
public ProctoringController(AppConfig appConfig, IFileSystem fileSystem, IModuleLogger logger, IUserInterfaceFactory uiFactory)
{
this.appConfig = appConfig;
@ -37,6 +42,11 @@ namespace SafeExamBrowser.Proctoring
this.uiFactory = uiFactory;
}
public void Activate()
{
window?.Show();
}
public void Initialize(ProctoringSettings settings)
{
if (settings.JitsiMeet.Enabled || settings.Zoom.Enabled)

View file

@ -78,6 +78,10 @@
<Project>{7d74555e-63e1-4c46-bd0a-8580552368c8}</Project>
<Name>SafeExamBrowser.Configuration.Contracts</Name>
</ProjectReference>
<ProjectReference Include="..\SafeExamBrowser.Core.Contracts\SafeExamBrowser.Core.Contracts.csproj">
<Project>{fe0e1224-b447-4b14-81e7-ed7d84822aa0}</Project>
<Name>SafeExamBrowser.Core.Contracts</Name>
</ProjectReference>
<ProjectReference Include="..\SafeExamBrowser.Logging.Contracts\SafeExamBrowser.Logging.Contracts.csproj">
<Project>{64ea30fb-11d4-436a-9c2b-88566285363e}</Project>
<Name>SafeExamBrowser.Logging.Contracts</Name>

View file

@ -7,7 +7,7 @@
*/
using System;
using SafeExamBrowser.Applications.Contracts.Resources.Icons;
using SafeExamBrowser.Core.Contracts.Resources.Icons;
using SafeExamBrowser.UserInterface.Contracts.Browser.Data;
using SafeExamBrowser.UserInterface.Contracts.Browser.Events;
using SafeExamBrowser.UserInterface.Contracts.Windows;

View file

@ -8,8 +8,8 @@
using System.Collections.Generic;
using SafeExamBrowser.Applications.Contracts;
using SafeExamBrowser.Client.Contracts;
using SafeExamBrowser.Configuration.Contracts;
using SafeExamBrowser.Core.Contracts.Notifications;
using SafeExamBrowser.I18n.Contracts;
using SafeExamBrowser.Logging.Contracts;
using SafeExamBrowser.Server.Contracts.Data;
@ -79,7 +79,7 @@ namespace SafeExamBrowser.UserInterface.Contracts
/// <summary>
/// Creates a notification control for the given notification, initialized for the specified location.
/// </summary>
INotificationControl CreateNotificationControl(INotificationController controller, INotificationInfo info, Location location);
INotificationControl CreateNotificationControl(INotification notification, Location location);
/// <summary>
/// Creates a password dialog with the given message and title.

View file

@ -108,14 +108,14 @@
<Project>{ac77745d-3b41-43e2-8e84-d40e5a4ee77f}</Project>
<Name>SafeExamBrowser.Applications.Contracts</Name>
</ProjectReference>
<ProjectReference Include="..\SafeExamBrowser.Client.Contracts\SafeExamBrowser.Client.Contracts.csproj">
<Project>{d39aea14-9d5e-404d-be39-a552e1bd2c7d}</Project>
<Name>SafeExamBrowser.Client.Contracts</Name>
</ProjectReference>
<ProjectReference Include="..\SafeExamBrowser.Configuration.Contracts\SafeExamBrowser.Configuration.Contracts.csproj">
<Project>{7d74555e-63e1-4c46-bd0a-8580552368c8}</Project>
<Name>SafeExamBrowser.Configuration.Contracts</Name>
</ProjectReference>
<ProjectReference Include="..\SafeExamBrowser.Core.Contracts\SafeExamBrowser.Core.Contracts.csproj">
<Project>{fe0e1224-b447-4b14-81e7-ed7d84822aa0}</Project>
<Name>SafeExamBrowser.Core.Contracts</Name>
</ProjectReference>
<ProjectReference Include="..\SafeExamBrowser.I18n.Contracts\SafeExamBrowser.I18n.Contracts.csproj">
<Project>{1858ddf3-bc2a-4bff-b663-4ce2ffeb8b7d}</Project>
<Name>SafeExamBrowser.I18n.Contracts</Name>

View file

@ -9,7 +9,7 @@
using System;
using System.Windows.Controls;
using SafeExamBrowser.Applications.Contracts;
using SafeExamBrowser.Applications.Contracts.Resources.Icons;
using SafeExamBrowser.Core.Contracts.Resources.Icons;
using SafeExamBrowser.UserInterface.Shared.Utilities;
namespace SafeExamBrowser.UserInterface.Desktop.Controls.ActionCenter

View file

@ -13,7 +13,7 @@ using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Media;
using System.Windows.Threading;
using SafeExamBrowser.Applications.Contracts.Resources.Icons;
using SafeExamBrowser.Core.Contracts.Resources.Icons;
using SafeExamBrowser.I18n.Contracts;
using SafeExamBrowser.SystemComponents.Contracts.Audio;
using SafeExamBrowser.UserInterface.Contracts.Shell;

View file

@ -8,7 +8,7 @@
using System.Windows;
using System.Windows.Controls;
using SafeExamBrowser.Client.Contracts;
using SafeExamBrowser.Core.Contracts.Notifications;
using SafeExamBrowser.UserInterface.Contracts.Shell;
using SafeExamBrowser.UserInterface.Shared.Utilities;
@ -16,26 +16,26 @@ namespace SafeExamBrowser.UserInterface.Desktop.Controls.ActionCenter
{
internal partial class NotificationButton : UserControl, INotificationControl
{
private INotificationController controller;
private INotification notification;
internal NotificationButton(INotificationController controller, INotificationInfo info)
internal NotificationButton(INotification notification)
{
this.controller = controller;
this.notification = notification;
InitializeComponent();
InitializeNotificationIcon(info);
InitializeNotification();
}
private void IconButton_Click(object sender, RoutedEventArgs e)
{
controller.Activate();
notification.Activate();
}
private void InitializeNotificationIcon(INotificationInfo info)
private void InitializeNotification()
{
Icon.Content = IconResourceLoader.Load(info.IconResource);
IconButton.ToolTip = info.Tooltip;
Text.Text = info.Tooltip;
Icon.Content = IconResourceLoader.Load(notification.IconResource);
IconButton.ToolTip = notification.Tooltip;
Text.Text = notification.Tooltip;
}
}
}

View file

@ -9,7 +9,7 @@
using System;
using System.ComponentModel;
using System.Windows.Controls;
using SafeExamBrowser.Applications.Contracts.Resources.Icons;
using SafeExamBrowser.Core.Contracts.Resources.Icons;
using SafeExamBrowser.UserInterface.Contracts.Shell.Events;
using SafeExamBrowser.UserInterface.Shared.Utilities;

View file

@ -12,7 +12,7 @@ using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using FontAwesome.WPF;
using SafeExamBrowser.Applications.Contracts.Resources.Icons;
using SafeExamBrowser.Core.Contracts.Resources.Icons;
using SafeExamBrowser.I18n.Contracts;
using SafeExamBrowser.SystemComponents.Contracts.WirelessNetwork;
using SafeExamBrowser.UserInterface.Contracts.Shell;

View file

@ -9,7 +9,7 @@
using System.Windows;
using System.Windows.Controls;
using SafeExamBrowser.Applications.Contracts;
using SafeExamBrowser.Applications.Contracts.Resources.Icons;
using SafeExamBrowser.Core.Contracts.Resources.Icons;
using SafeExamBrowser.UserInterface.Shared.Utilities;
namespace SafeExamBrowser.UserInterface.Desktop.Controls.Taskbar

View file

@ -12,7 +12,7 @@ using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Media;
using SafeExamBrowser.Applications.Contracts.Resources.Icons;
using SafeExamBrowser.Core.Contracts.Resources.Icons;
using SafeExamBrowser.I18n.Contracts;
using SafeExamBrowser.SystemComponents.Contracts.Audio;
using SafeExamBrowser.UserInterface.Contracts.Shell;

View file

@ -8,7 +8,7 @@
using System.Windows;
using System.Windows.Controls;
using SafeExamBrowser.Client.Contracts;
using SafeExamBrowser.Core.Contracts.Notifications;
using SafeExamBrowser.UserInterface.Contracts.Shell;
using SafeExamBrowser.UserInterface.Shared.Utilities;
@ -16,25 +16,25 @@ namespace SafeExamBrowser.UserInterface.Desktop.Controls.Taskbar
{
internal partial class NotificationButton : UserControl, INotificationControl
{
private INotificationController controller;
private INotification notification;
internal NotificationButton(INotificationController controller, INotificationInfo info)
internal NotificationButton(INotification notification)
{
this.controller = controller;
this.notification = notification;
InitializeComponent();
InitializeNotificationIcon(info);
InitializeNotification();
}
private void IconButton_Click(object sender, RoutedEventArgs e)
{
controller.Activate();
notification.Activate();
}
private void InitializeNotificationIcon(INotificationInfo info)
private void InitializeNotification()
{
IconButton.ToolTip = info.Tooltip;
IconButton.Content = IconResourceLoader.Load(info.IconResource);
IconButton.ToolTip = notification.Tooltip;
IconButton.Content = IconResourceLoader.Load(notification.IconResource);
}
}
}

View file

@ -10,7 +10,7 @@ using System;
using System.ComponentModel;
using System.Windows;
using System.Windows.Controls;
using SafeExamBrowser.Applications.Contracts.Resources.Icons;
using SafeExamBrowser.Core.Contracts.Resources.Icons;
using SafeExamBrowser.UserInterface.Contracts.Shell.Events;
using SafeExamBrowser.UserInterface.Shared.Utilities;

View file

@ -13,7 +13,7 @@ using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Media;
using FontAwesome.WPF;
using SafeExamBrowser.Applications.Contracts.Resources.Icons;
using SafeExamBrowser.Core.Contracts.Resources.Icons;
using SafeExamBrowser.I18n.Contracts;
using SafeExamBrowser.SystemComponents.Contracts.WirelessNetwork;
using SafeExamBrowser.UserInterface.Contracts.Shell;

View file

@ -11,7 +11,7 @@ using System.Windows;
using System.Windows.Controls;
using System.Windows.Threading;
using SafeExamBrowser.Applications.Contracts;
using SafeExamBrowser.Applications.Contracts.Resources.Icons;
using SafeExamBrowser.Core.Contracts.Resources.Icons;
using SafeExamBrowser.UserInterface.Shared.Utilities;
namespace SafeExamBrowser.UserInterface.Desktop.Controls.Taskview

View file

@ -479,14 +479,14 @@
<Project>{ac77745d-3b41-43e2-8e84-d40e5a4ee77f}</Project>
<Name>SafeExamBrowser.Applications.Contracts</Name>
</ProjectReference>
<ProjectReference Include="..\SafeExamBrowser.Client.Contracts\SafeExamBrowser.Client.Contracts.csproj">
<Project>{d39aea14-9d5e-404d-be39-a552e1bd2c7d}</Project>
<Name>SafeExamBrowser.Client.Contracts</Name>
</ProjectReference>
<ProjectReference Include="..\SafeExamBrowser.Configuration.Contracts\SafeExamBrowser.Configuration.Contracts.csproj">
<Project>{7d74555e-63e1-4c46-bd0a-8580552368c8}</Project>
<Name>SafeExamBrowser.Configuration.Contracts</Name>
</ProjectReference>
<ProjectReference Include="..\SafeExamBrowser.Core.Contracts\SafeExamBrowser.Core.Contracts.csproj">
<Project>{fe0e1224-b447-4b14-81e7-ed7d84822aa0}</Project>
<Name>SafeExamBrowser.Core.Contracts</Name>
</ProjectReference>
<ProjectReference Include="..\SafeExamBrowser.I18n.Contracts\SafeExamBrowser.I18n.Contracts.csproj">
<Project>{1858ddf3-bc2a-4bff-b663-4ce2ffeb8b7d}</Project>
<Name>SafeExamBrowser.I18n.Contracts</Name>

View file

@ -12,8 +12,8 @@ using System.Windows;
using System.Windows.Media;
using FontAwesome.WPF;
using SafeExamBrowser.Applications.Contracts;
using SafeExamBrowser.Client.Contracts;
using SafeExamBrowser.Configuration.Contracts;
using SafeExamBrowser.Core.Contracts.Notifications;
using SafeExamBrowser.I18n.Contracts;
using SafeExamBrowser.Logging.Contracts;
using SafeExamBrowser.Server.Contracts.Data;
@ -129,15 +129,15 @@ namespace SafeExamBrowser.UserInterface.Desktop
return window;
}
public INotificationControl CreateNotificationControl(INotificationController controller, INotificationInfo info, Location location)
public INotificationControl CreateNotificationControl(INotification notification, Location location)
{
if (location == Location.ActionCenter)
{
return new Controls.ActionCenter.NotificationButton(controller, info);
return new Controls.ActionCenter.NotificationButton(notification);
}
else
{
return new Controls.Taskbar.NotificationButton(controller, info);
return new Controls.Taskbar.NotificationButton(notification);
}
}

View file

@ -14,7 +14,7 @@ using System.Windows.Controls.Primitives;
using System.Windows.Input;
using System.Windows.Interop;
using System.Windows.Media.Imaging;
using SafeExamBrowser.Applications.Contracts.Resources.Icons;
using SafeExamBrowser.Core.Contracts.Resources.Icons;
using SafeExamBrowser.I18n.Contracts;
using SafeExamBrowser.Settings.Browser;
using SafeExamBrowser.UserInterface.Contracts;

View file

@ -5,5 +5,4 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:SafeExamBrowser.UserInterface.Desktop.Windows"
mc:Ignorable="d" Height="250" Width="350" Topmost="True" WindowStyle="None">
<DockPanel Name="ControlContainer" />
</Window>

View file

@ -71,7 +71,7 @@ namespace SafeExamBrowser.UserInterface.Desktop.Windows
{
if (control is UIElement element)
{
ControlContainer.Children.Add(element);
Content = element;
}
Closing += ProctoringWindow_Closing;

View file

@ -9,7 +9,7 @@
using System;
using System.Windows.Controls;
using SafeExamBrowser.Applications.Contracts;
using SafeExamBrowser.Applications.Contracts.Resources.Icons;
using SafeExamBrowser.Core.Contracts.Resources.Icons;
using SafeExamBrowser.UserInterface.Shared.Utilities;
namespace SafeExamBrowser.UserInterface.Mobile.Controls.ActionCenter

View file

@ -13,7 +13,7 @@ using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Media;
using System.Windows.Threading;
using SafeExamBrowser.Applications.Contracts.Resources.Icons;
using SafeExamBrowser.Core.Contracts.Resources.Icons;
using SafeExamBrowser.I18n.Contracts;
using SafeExamBrowser.SystemComponents.Contracts.Audio;
using SafeExamBrowser.UserInterface.Contracts.Shell;

View file

@ -8,7 +8,7 @@
using System.Windows;
using System.Windows.Controls;
using SafeExamBrowser.Client.Contracts;
using SafeExamBrowser.Core.Contracts.Notifications;
using SafeExamBrowser.UserInterface.Contracts.Shell;
using SafeExamBrowser.UserInterface.Shared.Utilities;
@ -16,26 +16,26 @@ namespace SafeExamBrowser.UserInterface.Mobile.Controls.ActionCenter
{
internal partial class NotificationButton : UserControl, INotificationControl
{
private INotificationController controller;
private INotification notification;
internal NotificationButton(INotificationController controller, INotificationInfo info)
internal NotificationButton(INotification notification)
{
this.controller = controller;
this.notification = notification;
InitializeComponent();
InitializeNotificationIcon(info);
InitializeNotification();
}
private void IconButton_Click(object sender, RoutedEventArgs e)
{
controller.Activate();
notification.Activate();
}
private void InitializeNotificationIcon(INotificationInfo info)
private void InitializeNotification()
{
Icon.Content = IconResourceLoader.Load(info.IconResource);
IconButton.ToolTip = info.Tooltip;
Text.Text = info.Tooltip;
Icon.Content = IconResourceLoader.Load(notification.IconResource);
IconButton.ToolTip = notification.Tooltip;
Text.Text = notification.Tooltip;
}
}
}

View file

@ -9,7 +9,7 @@
using System;
using System.ComponentModel;
using System.Windows.Controls;
using SafeExamBrowser.Applications.Contracts.Resources.Icons;
using SafeExamBrowser.Core.Contracts.Resources.Icons;
using SafeExamBrowser.UserInterface.Contracts.Shell.Events;
using SafeExamBrowser.UserInterface.Shared.Utilities;

View file

@ -12,7 +12,7 @@ using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using FontAwesome.WPF;
using SafeExamBrowser.Applications.Contracts.Resources.Icons;
using SafeExamBrowser.Core.Contracts.Resources.Icons;
using SafeExamBrowser.I18n.Contracts;
using SafeExamBrowser.SystemComponents.Contracts.WirelessNetwork;
using SafeExamBrowser.UserInterface.Contracts.Shell;

View file

@ -9,7 +9,7 @@
using System.Windows;
using System.Windows.Controls;
using SafeExamBrowser.Applications.Contracts;
using SafeExamBrowser.Applications.Contracts.Resources.Icons;
using SafeExamBrowser.Core.Contracts.Resources.Icons;
using SafeExamBrowser.UserInterface.Shared.Utilities;
namespace SafeExamBrowser.UserInterface.Mobile.Controls.Taskbar

View file

@ -12,7 +12,7 @@ using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Media;
using SafeExamBrowser.Applications.Contracts.Resources.Icons;
using SafeExamBrowser.Core.Contracts.Resources.Icons;
using SafeExamBrowser.I18n.Contracts;
using SafeExamBrowser.SystemComponents.Contracts.Audio;
using SafeExamBrowser.UserInterface.Contracts.Shell;

View file

@ -8,7 +8,7 @@
using System.Windows;
using System.Windows.Controls;
using SafeExamBrowser.Client.Contracts;
using SafeExamBrowser.Core.Contracts.Notifications;
using SafeExamBrowser.UserInterface.Contracts.Shell;
using SafeExamBrowser.UserInterface.Shared.Utilities;
@ -16,25 +16,25 @@ namespace SafeExamBrowser.UserInterface.Mobile.Controls.Taskbar
{
internal partial class NotificationButton : UserControl, INotificationControl
{
private INotificationController controller;
private INotification notification;
internal NotificationButton(INotificationController controller, INotificationInfo info)
internal NotificationButton(INotification notification)
{
this.controller = controller;
this.notification = notification;
InitializeComponent();
InitializeNotificationIcon(info);
InitializeNotification();
}
private void IconButton_Click(object sender, RoutedEventArgs e)
{
controller.Activate();
notification.Activate();
}
private void InitializeNotificationIcon(INotificationInfo info)
private void InitializeNotification()
{
IconButton.ToolTip = info.Tooltip;
IconButton.Content = IconResourceLoader.Load(info.IconResource);
IconButton.ToolTip = notification.Tooltip;
IconButton.Content = IconResourceLoader.Load(notification.IconResource);
}
}
}

View file

@ -10,7 +10,7 @@ using System;
using System.ComponentModel;
using System.Windows;
using System.Windows.Controls;
using SafeExamBrowser.Applications.Contracts.Resources.Icons;
using SafeExamBrowser.Core.Contracts.Resources.Icons;
using SafeExamBrowser.UserInterface.Contracts.Shell.Events;
using SafeExamBrowser.UserInterface.Shared.Utilities;

View file

@ -13,7 +13,7 @@ using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Media;
using FontAwesome.WPF;
using SafeExamBrowser.Applications.Contracts.Resources.Icons;
using SafeExamBrowser.Core.Contracts.Resources.Icons;
using SafeExamBrowser.I18n.Contracts;
using SafeExamBrowser.SystemComponents.Contracts.WirelessNetwork;
using SafeExamBrowser.UserInterface.Contracts.Shell;

View file

@ -10,7 +10,7 @@ using System;
using System.Windows;
using System.Windows.Controls;
using SafeExamBrowser.Applications.Contracts;
using SafeExamBrowser.Applications.Contracts.Resources.Icons;
using SafeExamBrowser.Core.Contracts.Resources.Icons;
using SafeExamBrowser.UserInterface.Shared.Utilities;
namespace SafeExamBrowser.UserInterface.Mobile.Controls.Taskview

View file

@ -198,14 +198,14 @@
<Project>{ac77745d-3b41-43e2-8e84-d40e5a4ee77f}</Project>
<Name>SafeExamBrowser.Applications.Contracts</Name>
</ProjectReference>
<ProjectReference Include="..\SafeExamBrowser.Client.Contracts\SafeExamBrowser.Client.Contracts.csproj">
<Project>{d39aea14-9d5e-404d-be39-a552e1bd2c7d}</Project>
<Name>SafeExamBrowser.Client.Contracts</Name>
</ProjectReference>
<ProjectReference Include="..\SafeExamBrowser.Configuration.Contracts\SafeExamBrowser.Configuration.Contracts.csproj">
<Project>{7d74555e-63e1-4c46-bd0a-8580552368c8}</Project>
<Name>SafeExamBrowser.Configuration.Contracts</Name>
</ProjectReference>
<ProjectReference Include="..\SafeExamBrowser.Core.Contracts\SafeExamBrowser.Core.Contracts.csproj">
<Project>{fe0e1224-b447-4b14-81e7-ed7d84822aa0}</Project>
<Name>SafeExamBrowser.Core.Contracts</Name>
</ProjectReference>
<ProjectReference Include="..\SafeExamBrowser.I18n.Contracts\SafeExamBrowser.I18n.Contracts.csproj">
<Project>{1858ddf3-bc2a-4bff-b663-4ce2ffeb8b7d}</Project>
<Name>SafeExamBrowser.I18n.Contracts</Name>

View file

@ -12,8 +12,8 @@ using System.Windows;
using System.Windows.Media;
using FontAwesome.WPF;
using SafeExamBrowser.Applications.Contracts;
using SafeExamBrowser.Client.Contracts;
using SafeExamBrowser.Configuration.Contracts;
using SafeExamBrowser.Core.Contracts.Notifications;
using SafeExamBrowser.I18n.Contracts;
using SafeExamBrowser.Logging.Contracts;
using SafeExamBrowser.Server.Contracts.Data;
@ -129,15 +129,15 @@ namespace SafeExamBrowser.UserInterface.Mobile
return window;
}
public INotificationControl CreateNotificationControl(INotificationController controller, INotificationInfo info, Location location)
public INotificationControl CreateNotificationControl(INotification notification, Location location)
{
if (location == Location.ActionCenter)
{
return new Controls.ActionCenter.NotificationButton(controller, info);
return new Controls.ActionCenter.NotificationButton(notification);
}
else
{
return new Controls.Taskbar.NotificationButton(controller, info);
return new Controls.Taskbar.NotificationButton(notification);
}
}

View file

@ -14,7 +14,7 @@ using System.Windows.Controls.Primitives;
using System.Windows.Input;
using System.Windows.Interop;
using System.Windows.Media.Imaging;
using SafeExamBrowser.Applications.Contracts.Resources.Icons;
using SafeExamBrowser.Core.Contracts.Resources.Icons;
using SafeExamBrowser.I18n.Contracts;
using SafeExamBrowser.Settings.Browser;
using SafeExamBrowser.UserInterface.Contracts;

View file

@ -79,9 +79,9 @@
<Compile Include="Utilities\WindowExtensions.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\SafeExamBrowser.Applications.Contracts\SafeExamBrowser.Applications.Contracts.csproj">
<Project>{ac77745d-3b41-43e2-8e84-d40e5a4ee77f}</Project>
<Name>SafeExamBrowser.Applications.Contracts</Name>
<ProjectReference Include="..\SafeExamBrowser.Core.Contracts\SafeExamBrowser.Core.Contracts.csproj">
<Project>{fe0e1224-b447-4b14-81e7-ed7d84822aa0}</Project>
<Name>SafeExamBrowser.Core.Contracts</Name>
</ProjectReference>
<ProjectReference Include="..\SafeExamBrowser.Logging.Contracts\SafeExamBrowser.Logging.Contracts.csproj">
<Project>{64ea30fb-11d4-436a-9c2b-88566285363e}</Project>

View file

@ -16,7 +16,7 @@ using System.Windows.Documents;
using System.Windows.Interop;
using System.Windows.Markup;
using System.Windows.Media.Imaging;
using SafeExamBrowser.Applications.Contracts.Resources.Icons;
using SafeExamBrowser.Core.Contracts.Resources.Icons;
using Brushes = System.Windows.Media.Brushes;
using Image = System.Windows.Controls.Image;

View file

@ -72,8 +72,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SafeExamBrowser.Browser.Con
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SafeExamBrowser.Applications.Contracts", "SafeExamBrowser.Applications.Contracts\SafeExamBrowser.Applications.Contracts.csproj", "{AC77745D-3B41-43E2-8E84-D40E5A4EE77F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SafeExamBrowser.Client.Contracts", "SafeExamBrowser.Client.Contracts\SafeExamBrowser.Client.Contracts.csproj", "{D39AEA14-9D5E-404D-BE39-A552E1BD2C7D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SafeExamBrowser.Communication.Contracts", "SafeExamBrowser.Communication.Contracts\SafeExamBrowser.Communication.Contracts.csproj", "{0CD2C5FE-711A-4C32-AFE0-BB804FE8B220}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SafeExamBrowser.Configuration.Contracts", "SafeExamBrowser.Configuration.Contracts\SafeExamBrowser.Configuration.Contracts.csproj", "{7D74555E-63E1-4C46-BD0A-8580552368C8}"
@ -334,14 +332,6 @@ Global
{AC77745D-3B41-43E2-8E84-D40E5A4EE77F}.Release|x64.Build.0 = Release|x64
{AC77745D-3B41-43E2-8E84-D40E5A4EE77F}.Release|x86.ActiveCfg = Release|x86
{AC77745D-3B41-43E2-8E84-D40E5A4EE77F}.Release|x86.Build.0 = Release|x86
{D39AEA14-9D5E-404D-BE39-A552E1BD2C7D}.Debug|x64.ActiveCfg = Debug|x64
{D39AEA14-9D5E-404D-BE39-A552E1BD2C7D}.Debug|x64.Build.0 = Debug|x64
{D39AEA14-9D5E-404D-BE39-A552E1BD2C7D}.Debug|x86.ActiveCfg = Debug|x86
{D39AEA14-9D5E-404D-BE39-A552E1BD2C7D}.Debug|x86.Build.0 = Debug|x86
{D39AEA14-9D5E-404D-BE39-A552E1BD2C7D}.Release|x64.ActiveCfg = Release|x64
{D39AEA14-9D5E-404D-BE39-A552E1BD2C7D}.Release|x64.Build.0 = Release|x64
{D39AEA14-9D5E-404D-BE39-A552E1BD2C7D}.Release|x86.ActiveCfg = Release|x86
{D39AEA14-9D5E-404D-BE39-A552E1BD2C7D}.Release|x86.Build.0 = Release|x86
{0CD2C5FE-711A-4C32-AFE0-BB804FE8B220}.Debug|x64.ActiveCfg = Debug|x64
{0CD2C5FE-711A-4C32-AFE0-BB804FE8B220}.Debug|x64.Build.0 = Debug|x64
{0CD2C5FE-711A-4C32-AFE0-BB804FE8B220}.Debug|x86.ActiveCfg = Debug|x86