Restore SEBPatch

This commit is contained in:
2025-06-01 11:44:20 +02:00
commit 8c656e3137
1297 changed files with 142172 additions and 0 deletions

View File

@@ -0,0 +1,53 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* 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;
namespace SafeExamBrowser.UserInterface.Contracts.Browser.Data
{
/// <summary>
/// Defines the state of a download item.
/// </summary>
public class DownloadItemState
{
/// <summary>
/// The current completion of the item, as percentage value from <c>0.0</c> to <c>1.0</c>.
/// </summary>
public double Completion { get; set; }
/// <summary>
/// The full path of the download location for the item.
/// </summary>
public string FullPath { get; set; }
/// <summary>
/// The unique identifier of the item.
/// </summary>
public Guid Id { get; set; }
/// <summary>
/// Indicates that the download was cancelled.
/// </summary>
public bool IsCancelled { get; set; }
/// <summary>
/// Indicates that the download was completed.
/// </summary>
public bool IsComplete { get; set; }
/// <summary>
/// The download URL of the item.
/// </summary>
public string Url { get; set; }
public DownloadItemState(Guid id)
{
Id = id;
}
}
}

View File

@@ -0,0 +1,31 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* 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/.
*/
namespace SafeExamBrowser.UserInterface.Contracts.Browser.Data
{
/// <summary>
/// The data resulting from a JavaScript expression evaluation.
/// </summary>
public class JavaScriptResult
{
/// <summary>
/// Indicates if the JavaScript was evaluated successfully or not.
/// </summary>
public bool Success { get; set; }
/// <summary>
/// The error message, in case of an unsuccessful evaluation of the JavaScript expression.
/// </summary>
public string Message { get; set; }
/// <summary>
/// The data item returned by the JavaScript expression.
/// </summary>
public object Result { get; set; }
}
}

View File

@@ -0,0 +1,15 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* 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/.
*/
namespace SafeExamBrowser.UserInterface.Contracts.Browser.Events
{
/// <summary>
/// Indicates that the address has changed to the specified value.
/// </summary>
public delegate void AddressChangedEventHandler(string address);
}

View File

@@ -0,0 +1,15 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* 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/.
*/
namespace SafeExamBrowser.UserInterface.Contracts.Browser.Events
{
/// <summary>
/// Indicates that a page search is being requested.
/// </summary>
public delegate void FindRequestedEventHandler(string term, bool isInitial, bool caseSensitive, bool forward = true);
}

View File

@@ -0,0 +1,15 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* 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/.
*/
namespace SafeExamBrowser.UserInterface.Contracts.Browser.Events
{
/// <summary>
/// Indicates a load error for a browser request.
/// </summary>
public delegate void LoadFailedEventHandler(int errorCode, string errorText, bool isMainRequest, string url);
}

View File

@@ -0,0 +1,15 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* 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/.
*/
namespace SafeExamBrowser.UserInterface.Contracts.Browser.Events
{
/// <summary>
/// Indicates that the loading state of a <see cref="IBrowserControl"/> has changed, i.e. whether it's loading or not.
/// </summary>
public delegate void LoadingStateChangedEventHandler(bool isLoading);
}

View File

@@ -0,0 +1,15 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* 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/.
*/
namespace SafeExamBrowser.UserInterface.Contracts.Browser.Events
{
/// <summary>
/// Indicates that the title of a <see cref="IBrowserControl"/> has changed.
/// </summary>
public delegate void TitleChangedEventHandler(string title);
}

View File

@@ -0,0 +1,111 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* 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.UserInterface.Contracts.Browser.Data;
using SafeExamBrowser.UserInterface.Contracts.Browser.Events;
namespace SafeExamBrowser.UserInterface.Contracts.Browser
{
/// <summary>
/// Defines the functionality of a browser control (i.e. an instance of the browser resp. its user interface) and is normally embedded
/// within an <see cref="IBrowserWindow"/>.
/// </summary>
public interface IBrowserControl
{
/// <summary>
/// The address which is currently loaded.
/// </summary>
string Address { get; }
/// <summary>
/// Indicates whether a backward navigation can be performed.
/// </summary>
bool CanNavigateBackwards { get; }
/// <summary>
/// Indicates whether a forward navigation can be performed.
/// </summary>
bool CanNavigateForwards { get; }
/// <summary>
/// The user interface control to be embedded in an <see cref="IBrowserWindow"/>.
/// </summary>
object EmbeddableControl { get; }
/// <summary>
/// Event fired when the address of the browser control changes.
/// </summary>
event AddressChangedEventHandler AddressChanged;
/// <summary>
/// Event fired when a load error occurs.
/// </summary>
event LoadFailedEventHandler LoadFailed;
/// <summary>
/// Event fired when the loading state of the browser control changes.
/// </summary>
event LoadingStateChangedEventHandler LoadingStateChanged;
/// <summary>
/// Event fired when the current page (and thus the title) of the browser control changes.
/// </summary>
event TitleChangedEventHandler TitleChanged;
/// <summary>
/// Finalizes the browser control (e.g. stops audio / video playback) and releases all used resources.
/// </summary>
void Destroy();
/// <summary>
/// Executes the given JavaScript code in the browser. An optional callback may be used to process a potential <see cref="JavaScriptResult"/>.
/// </summary>
void ExecuteJavaScript(string code, Action<JavaScriptResult> callback = default);
/// <summary>
/// Attempts to find the given term on the current page according to the specified parameters.
/// </summary>
void Find(string term, bool isInitial, bool caseSensitive, bool forward = true);
/// <summary>
/// Initializes the browser control.
/// </summary>
void Initialize();
/// <summary>
/// Navigates to the previous page in the browser control history.
/// </summary>
void NavigateBackwards();
/// <summary>
/// Navigates to the next page in the browser control history.
/// </summary>
void NavigateForwards();
/// <summary>
/// Navigates to the specified web address.
/// </summary>
void NavigateTo(string address);
/// <summary>
/// Opens the developer console or actives it, if it is already open.
/// </summary>
void ShowDeveloperConsole();
/// <summary>
/// Reloads the current web page.
/// </summary>
void Reload();
/// <summary>
/// Sets the page zoom to the given level. A value of <c>0</c> resets the page zoom.
/// </summary>
void Zoom(double level);
}
}

View File

@@ -0,0 +1,149 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* 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.Browser.Contracts.Events;
using SafeExamBrowser.Core.Contracts.Resources.Icons;
using SafeExamBrowser.UserInterface.Contracts.Browser.Data;
using SafeExamBrowser.UserInterface.Contracts.Browser.Events;
using SafeExamBrowser.UserInterface.Contracts.Windows;
namespace SafeExamBrowser.UserInterface.Contracts.Browser
{
/// <summary>
/// Defines the functionality of a browser window, i.e. a window with an embedded browser instance (see <see cref="IBrowserControl"/>).
/// </summary>
public interface IBrowserWindow : IWindow
{
/// <summary>
/// Enables the backward navigation button.
/// </summary>
bool CanNavigateBackwards { set; }
/// <summary>
/// Enables the forward navigation button.
/// </summary>
bool CanNavigateForwards { set; }
/// <summary>
/// The native handle of the window.
/// </summary>
IntPtr Handle { get; }
/// <summary>
/// Event fired when the user changed the URL.
/// </summary>
event AddressChangedEventHandler AddressChanged;
/// <summary>
/// Event fired when the user would like to navigate backwards.
/// </summary>
event ActionRequestedEventHandler BackwardNavigationRequested;
/// <summary>
/// Event fired when the user would like to open the developer console.
/// </summary>
event ActionRequestedEventHandler DeveloperConsoleRequested;
/// <summary>
/// Event fired when the user would like to search the current page.
/// </summary>
event FindRequestedEventHandler FindRequested;
/// <summary>
/// Event fired when the user would like to navigate forwards.
/// </summary>
event ActionRequestedEventHandler ForwardNavigationRequested;
/// <summary>
/// Event fired when the user would like to navigate home.
/// </summary>
event ActionRequestedEventHandler HomeNavigationRequested;
/// <summary>
/// Event fired when the browser window wants to lose focus to the taskbar.
/// </summary>
event LoseFocusRequestedEventHandler LoseFocusRequested;
/// <summary>
/// Event fired when the user would like to reload the current page.
/// </summary>
event ActionRequestedEventHandler ReloadRequested;
/// <summary>
/// Event fired when the user would like to zoom in.
/// </summary>
event ActionRequestedEventHandler ZoomInRequested;
/// <summary>
/// Event fired when the user would like to zoom out.
/// </summary>
event ActionRequestedEventHandler ZoomOutRequested;
/// <summary>
/// Event fired when the user would like to reset the zoom factor.
/// </summary>
event ActionRequestedEventHandler ZoomResetRequested;
/// <summary>
/// Sets the focus on the address bar of the window.
/// </summary>
void FocusAddressBar();
/// <summary>
/// Sets the focus on the browser content of the window.
/// </summary>
void FocusBrowser();
/// <summary>
/// Sets the focus on the toolbar of the window. If the parameter is set to true, the first focusable control on the toolbar gets focused.
/// If it is set to false, the last one.
/// </summary>
void FocusToolbar(bool forward);
/// <summary>
/// Displays the find toolbar to search the content of a page.
/// </summary>
void ShowFindbar();
/// <summary>
/// Updates the address bar of the browser window to the given value.
/// </summary>
void UpdateAddress(string adress);
/// <summary>
/// Updates the icon of the browser window.
/// </summary>
void UpdateIcon(IconResource icon);
/// <summary>
/// Updates the download state for the given item.
/// </summary>
void UpdateDownloadState(DownloadItemState state);
/// <summary>
/// Updates the loading state according to the given value.
/// </summary>
void UpdateLoadingState(bool isLoading);
/// <summary>
/// Updates the page load progress according to the given value.
/// </summary>
void UpdateProgress(double value);
/// <summary>
/// Sets the title of the browser window to the given value.
/// </summary>
void UpdateTitle(string title);
/// <summary>
/// Updates the display value of the current page zoom. Value is expected to be in percentage.
/// </summary>
void UpdateZoomLevel(double value);
}
}

View File

@@ -0,0 +1,15 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* 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/.
*/
namespace SafeExamBrowser.UserInterface.Contracts
{
/// <summary>
/// Indicates that the user requested an action.
/// </summary>
public delegate void ActionRequestedEventHandler();
}

View File

@@ -0,0 +1,26 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* 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/.
*/
namespace SafeExamBrowser.UserInterface.Contracts.FileSystemDialog
{
/// <summary>
/// Defines the user interaction result of an <see cref="IFileSystemDialog"/>.
/// </summary>
public class FileSystemDialogResult
{
/// <summary>
/// The full path of the item selected by the user, or <c>null</c> if the interaction was unsuccessful.
/// </summary>
public string FullPath { get; set; }
/// <summary>
/// Indicates whether the user confirmed the dialog or not.
/// </summary>
public bool Success { get; set; }
}
}

View File

@@ -0,0 +1,26 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* 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/.
*/
namespace SafeExamBrowser.UserInterface.Contracts.FileSystemDialog
{
/// <summary>
/// Defines all elements supported by an <see cref="IFileSystemDialog"/>
/// </summary>
public enum FileSystemElement
{
/// <summary>
/// A dialog to perform an operation with a file.
/// </summary>
File,
/// <summary>
/// A dialog to perform an operation with a folder.
/// </summary>
Folder
}
}

View File

@@ -0,0 +1,26 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* 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/.
*/
namespace SafeExamBrowser.UserInterface.Contracts.FileSystemDialog
{
/// <summary>
/// Defines all operations supported by an <see cref="IFileSystemDialog"/>
/// </summary>
public enum FileSystemOperation
{
/// <summary>
/// A dialog to open a file system element.
/// </summary>
Open,
/// <summary>
/// A dialog to save a file system element.
/// </summary>
Save
}
}

View File

@@ -0,0 +1,28 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* 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.UserInterface.Contracts.Windows;
namespace SafeExamBrowser.UserInterface.Contracts.FileSystemDialog
{
public interface IFileSystemDialog
{
/// <summary>
/// Creates a dialog according to the given parameters and shows it to the user.
/// </summary>
FileSystemDialogResult Show(
FileSystemElement element,
FileSystemOperation operation,
string initialPath = default,
string message = default,
string title = default,
IWindow parent = default,
bool restrictNavigation = false,
bool showElementPath = true);
}
}

View File

@@ -0,0 +1,48 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* 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.I18n.Contracts;
namespace SafeExamBrowser.UserInterface.Contracts
{
/// <summary>
/// A progress indicator is a user interface element which displays the (completion) status of a procedure to the user.
/// </summary>
public interface IProgressIndicator
{
/// <summary>
/// Increases the current progress value by 1.
/// </summary>
void Progress();
/// <summary>
/// Decreases the current progress value by 1.
/// </summary>
void Regress();
/// <summary>
/// Sets the style of the progress indicator to indeterminate (<c>Progress</c> and <c>Regress</c> won't have any effect when called).
/// </summary>
void SetIndeterminate();
/// <summary>
/// Sets the maximum progress value. Resets the style of the progress indicator to determinate in case it has been set to indeterminate.
/// </summary>
void SetMaxValue(int max);
/// <summary>
/// Sets the current progress value.
/// </summary>
void SetValue(int value);
/// <summary>
/// Updates the status text. If the busy flag is set, an animation will be shown to indicate a long-running operation.
/// </summary>
void UpdateStatus(TextKey key, bool busyIndication = false);
}
}

View File

@@ -0,0 +1,152 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* 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.Collections.Generic;
using SafeExamBrowser.Applications.Contracts;
using SafeExamBrowser.Configuration.Contracts;
using SafeExamBrowser.Core.Contracts.Notifications;
using SafeExamBrowser.I18n.Contracts;
using SafeExamBrowser.Logging.Contracts;
using SafeExamBrowser.Proctoring.Contracts;
using SafeExamBrowser.Server.Contracts.Data;
using SafeExamBrowser.Settings.Browser;
using SafeExamBrowser.Settings.Proctoring;
using SafeExamBrowser.Settings.UserInterface;
using SafeExamBrowser.SystemComponents.Contracts.Audio;
using SafeExamBrowser.SystemComponents.Contracts.Keyboard;
using SafeExamBrowser.SystemComponents.Contracts.Network;
using SafeExamBrowser.SystemComponents.Contracts.PowerSupply;
using SafeExamBrowser.UserInterface.Contracts.Browser;
using SafeExamBrowser.UserInterface.Contracts.Proctoring;
using SafeExamBrowser.UserInterface.Contracts.Shell;
using SafeExamBrowser.UserInterface.Contracts.Windows;
using SafeExamBrowser.UserInterface.Contracts.Windows.Data;
namespace SafeExamBrowser.UserInterface.Contracts
{
/// <summary>
/// The factory for user interface elements which cannot be instantiated at the composition root.
/// </summary>
public interface IUserInterfaceFactory
{
/// <summary>
/// Creates a new about window displaying information about the currently running application version.
/// </summary>
IWindow CreateAboutWindow(AppConfig appConfig);
/// <summary>
/// Creates a new action center.
/// </summary>
IActionCenter CreateActionCenter();
/// <summary>
/// Creates an application control for the specified application and location.
/// </summary>
IApplicationControl CreateApplicationControl(IApplication<IApplicationWindow> application, Location location);
/// <summary>
/// Creates a system control which allows to change the audio settings of the computer.
/// </summary>
ISystemControl CreateAudioControl(IAudio audio, Location location);
/// <summary>
/// Creates a new browser window loaded with the given browser control and settings.
/// </summary>
IBrowserWindow CreateBrowserWindow(IBrowserControl control, BrowserSettings settings, bool isMainWindow, ILogger logger);
/// <summary>
/// Creates a credentials dialog for the given purpose and with the specified message and title.
/// </summary>
ICredentialsDialog CreateCredentialsDialog(CredentialsDialogPurpose purpose, string message, string title);
/// <summary>
/// Creates an exam selection dialog for the given exams.
/// </summary>
IExamSelectionDialog CreateExamSelectionDialog(IEnumerable<Exam> exams);
/// <summary>
/// Creates a system control which allows to change the keyboard layout of the computer.
/// </summary>
ISystemControl CreateKeyboardLayoutControl(IKeyboard keyboard, Location location);
/// <summary>
/// Creates a lock screen with the given message, title and options.
/// </summary>
ILockScreen CreateLockScreen(string message, string title, IEnumerable<LockScreenOption> options, LockScreenSettings settings);
/// <summary>
/// Creates a new log window which runs on its own thread.
/// </summary>
IWindow CreateLogWindow(ILogger logger);
/// <summary>
/// Creates a system control which allows to view and/or change the network connection of the computer.
/// </summary>
ISystemControl CreateNetworkControl(INetworkAdapter adapter, Location location);
/// <summary>
/// Creates a notification control for the given notification, initialized for the specified location.
/// </summary>
INotificationControl CreateNotificationControl(INotification notification, Location location);
/// <summary>
/// Creates a password dialog with the given message and title.
/// </summary>
IPasswordDialog CreatePasswordDialog(string message, string title);
/// <summary>
/// Creates a password dialog with the given message and title.
/// </summary>
IPasswordDialog CreatePasswordDialog(TextKey message, TextKey title);
/// <summary>
/// Creates a system control displaying the power supply status of the computer.
/// </summary>
ISystemControl CreatePowerSupplyControl(IPowerSupply powerSupply, Location location);
/// <summary>
/// Creates a new dialog to display the status of the proctoring finalization.
/// </summary>
IProctoringFinalizationDialog CreateProctoringFinalizationDialog();
/// <summary>
/// Creates a new proctoring window loaded with the given proctoring control.
/// </summary>
IProctoringWindow CreateProctoringWindow(IProctoringControl control);
/// <summary>
/// Creates a new notification control for the raise hand functionality of a remote proctoring session.
/// </summary>
INotificationControl CreateRaiseHandControl(IProctoringController controller, Location location, ProctoringSettings settings);
/// <summary>
/// Creates a new runtime window which runs on its own thread.
/// </summary>
IRuntimeWindow CreateRuntimeWindow(AppConfig appConfig);
/// <summary>
/// Creates a new server failure dialog with the given parameters.
/// </summary>
IServerFailureDialog CreateServerFailureDialog(string info, bool showFallback);
/// <summary>
/// Creates a new splash screen which runs on its own thread.
/// </summary>
ISplashScreen CreateSplashScreen(AppConfig appConfig = null);
/// <summary>
/// Creates a new taskbar.
/// </summary>
ITaskbar CreateTaskbar(ILogger logger);
/// <summary>
/// Creates a new taskview.
/// </summary>
ITaskview CreateTaskview();
}
}

View File

@@ -0,0 +1,29 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* 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.I18n.Contracts;
using SafeExamBrowser.UserInterface.Contracts.Windows;
namespace SafeExamBrowser.UserInterface.Contracts.MessageBox
{
/// <summary>
/// Defines the API for message boxes.
/// </summary>
public interface IMessageBox
{
/// <summary>
/// Shows a message box according to the specified parameters and returns the result chosen by the user.
/// </summary>
MessageBoxResult Show(string message, string title, MessageBoxAction action = MessageBoxAction.Ok, MessageBoxIcon icon = MessageBoxIcon.Information, IWindow parent = null);
/// <summary>
/// Shows a message box according to the specified parameters and returns the result chosen by the user.
/// </summary>
MessageBoxResult Show(TextKey message, TextKey title, MessageBoxAction action = MessageBoxAction.Ok, MessageBoxIcon icon = MessageBoxIcon.Information, IWindow parent = null);
}
}

View File

@@ -0,0 +1,20 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* 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/.
*/
namespace SafeExamBrowser.UserInterface.Contracts.MessageBox
{
/// <summary>
/// Defines all actions available for a message box.
/// </summary>
public enum MessageBoxAction
{
Ok,
OkCancel,
YesNo
}
}

View File

@@ -0,0 +1,21 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* 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/.
*/
namespace SafeExamBrowser.UserInterface.Contracts.MessageBox
{
/// <summary>
/// Defines all icons available in a message box.
/// </summary>
public enum MessageBoxIcon
{
Error,
Information,
Question,
Warning
}
}

View File

@@ -0,0 +1,22 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* 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/.
*/
namespace SafeExamBrowser.UserInterface.Contracts.MessageBox
{
/// <summary>
/// Defines all possible results of a message box.
/// </summary>
public enum MessageBoxResult
{
None = 0,
Cancel,
No,
Ok,
Yes
}
}

View File

@@ -0,0 +1,15 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* 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/.
*/
namespace SafeExamBrowser.UserInterface.Contracts.Proctoring.Events
{
/// <summary>
/// Indicates that the full screen state has changed.
/// </summary>
public delegate void FullScreenChangedEventHandler(bool fullScreen);
}

View File

@@ -0,0 +1,24 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* 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.UserInterface.Contracts.Proctoring.Events;
namespace SafeExamBrowser.UserInterface.Contracts.Proctoring
{
/// <summary>
/// Defines the functionality of a proctoring control, i.e. a web view running a WebRTC-enabled web application, which normally is embedded in
/// a <see cref="IProctoringWindow"/>.
/// </summary>
public interface IProctoringControl
{
/// <summary>
/// Event fired when the full screen state changed.
/// </summary>
event FullScreenChangedEventHandler FullScreenChanged;
}
}

View File

@@ -0,0 +1,28 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* 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.Proctoring.Contracts.Events;
namespace SafeExamBrowser.UserInterface.Contracts.Proctoring
{
/// <summary>
/// The dialog to display the status of the proctoring finalization.
/// </summary>
public interface IProctoringFinalizationDialog
{
/// <summary>
/// Shows the dialog as topmost window.
/// </summary>
void Show();
/// <summary>
/// Updates the status of the finalization.
/// </summary>
void Update(RemainingWorkUpdatedEventArgs status);
}
}

View File

@@ -0,0 +1,34 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* 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.UserInterface.Contracts.Windows;
namespace SafeExamBrowser.UserInterface.Contracts.Proctoring
{
/// <summary>
/// Defines the functionality of a proctoring window.
/// </summary>
public interface IProctoringWindow : IWindow
{
/// <summary>
/// First moves the window to the background and then hides it after a timeout. This might be necessary to allow the meeting client to
/// finish its initialization work and start the microphone as well as the camera before being hidden.
/// </summary>
void HideWithDelay();
/// <summary>
/// Sets the window title to the given value.
/// </summary>
void SetTitle(string title);
/// <summary>
/// Toggles the window visibility.
/// </summary>
void Toggle();
}
}

View File

@@ -0,0 +1,33 @@
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.UserInterface.Contracts")]
[assembly: AssemblyDescription("Safe Exam Browser")]
[assembly: AssemblyCompany("ETH Zürich")]
[assembly: AssemblyProduct("SafeExamBrowser.UserInterface.Contracts")]
[assembly: AssemblyCopyright("Copyright © 2024 ETH Zürich, IT Services")]
// 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("c7889e97-6ff6-4a58-b7cb-521ed276b316")]
// 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

@@ -0,0 +1,158 @@
<?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>{C7889E97-6FF6-4A58-B7CB-521ED276B316}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>SafeExamBrowser.UserInterface.Contracts</RootNamespace>
<AssemblyName>SafeExamBrowser.UserInterface.Contracts</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
<TargetFrameworkProfile />
</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="Browser\Data\DownloadItemState.cs" />
<Compile Include="Browser\Data\JavaScriptResult.cs" />
<Compile Include="Browser\Events\AddressChangedEventHandler.cs" />
<Compile Include="Browser\Events\FindRequestedEventHandler.cs" />
<Compile Include="Browser\Events\LoadFailedEventHandler.cs" />
<Compile Include="Browser\Events\LoadingStateChangedEventHandler.cs" />
<Compile Include="Browser\Events\TitleChangedEventHandler.cs" />
<Compile Include="Browser\IBrowserControl.cs" />
<Compile Include="Browser\IBrowserWindow.cs" />
<Compile Include="Events\ActionRequestedEventHandler.cs" />
<Compile Include="FileSystemDialog\FileSystemDialogResult.cs" />
<Compile Include="FileSystemDialog\FileSystemElement.cs" />
<Compile Include="FileSystemDialog\FileSystemOperation.cs" />
<Compile Include="FileSystemDialog\IFileSystemDialog.cs" />
<Compile Include="Proctoring\Events\FullScreenChangedEventHandler.cs" />
<Compile Include="Proctoring\IProctoringControl.cs" />
<Compile Include="Proctoring\IProctoringWindow.cs" />
<Compile Include="IProgressIndicator.cs" />
<Compile Include="IUserInterfaceFactory.cs" />
<Compile Include="MessageBox\IMessageBox.cs" />
<Compile Include="MessageBox\MessageBoxAction.cs" />
<Compile Include="MessageBox\MessageBoxIcon.cs" />
<Compile Include="MessageBox\MessageBoxResult.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Shell\Events\ActivatorEventHandler.cs" />
<Compile Include="Shell\Events\QuitButtonClickedEventHandler.cs" />
<Compile Include="Shell\IActionCenter.cs" />
<Compile Include="Shell\IActionCenterActivator.cs" />
<Compile Include="Shell\IActivator.cs" />
<Compile Include="Shell\IApplicationControl.cs" />
<Compile Include="Shell\INotificationControl.cs" />
<Compile Include="Shell\ISystemControl.cs" />
<Compile Include="Shell\ITaskbar.cs" />
<Compile Include="Shell\ITaskbarActivator.cs" />
<Compile Include="Shell\ITaskview.cs" />
<Compile Include="Shell\ITaskviewActivator.cs" />
<Compile Include="Shell\ITerminationActivator.cs" />
<Compile Include="Shell\Location.cs" />
<Compile Include="Windows\Data\CredentialsDialogPurpose.cs" />
<Compile Include="Windows\Data\ExamSelectionDialogResult.cs" />
<Compile Include="Windows\Data\LockScreenOption.cs" />
<Compile Include="Windows\Data\LockScreenResult.cs" />
<Compile Include="Windows\Data\CredentialsDialogResult.cs" />
<Compile Include="Windows\Data\ServerFailureDialogResult.cs" />
<Compile Include="Windows\Events\WindowClosedEventHandler.cs" />
<Compile Include="Windows\Events\WindowClosingEventHandler.cs" />
<Compile Include="Windows\IExamSelectionDialog.cs" />
<Compile Include="Windows\ILockScreen.cs" />
<Compile Include="Windows\ICredentialsDialog.cs" />
<Compile Include="Windows\IPasswordDialog.cs" />
<Compile Include="Windows\Data\PasswordDialogResult.cs" />
<Compile Include="Proctoring\IProctoringFinalizationDialog.cs" />
<Compile Include="Windows\IRuntimeWindow.cs" />
<Compile Include="Windows\IServerFailureDialog.cs" />
<Compile Include="Windows\ISplashScreen.cs" />
<Compile Include="Windows\IWindow.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.Browser.Contracts\SafeExamBrowser.Browser.Contracts.csproj">
<Project>{5fb5273d-277c-41dd-8593-a25ce1aff2e9}</Project>
<Name>SafeExamBrowser.Browser.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>
</ProjectReference>
<ProjectReference Include="..\SafeExamBrowser.Logging.Contracts\SafeExamBrowser.Logging.Contracts.csproj">
<Project>{64ea30fb-11d4-436a-9c2b-88566285363e}</Project>
<Name>SafeExamBrowser.Logging.Contracts</Name>
</ProjectReference>
<ProjectReference Include="..\SafeExamBrowser.Proctoring.Contracts\SafeExamBrowser.Proctoring.Contracts.csproj">
<Project>{8e52bd1c-0540-4f16-b181-6665d43f7a7b}</Project>
<Name>SafeExamBrowser.Proctoring.Contracts</Name>
</ProjectReference>
<ProjectReference Include="..\SafeExamBrowser.Server.Contracts\SafeExamBrowser.Server.Contracts.csproj">
<Project>{db701e6f-bddc-4cec-b662-335a9dc11809}</Project>
<Name>SafeExamBrowser.Server.Contracts</Name>
</ProjectReference>
<ProjectReference Include="..\SafeExamBrowser.Settings\SafeExamBrowser.Settings.csproj">
<Project>{30b2d907-5861-4f39-abad-c4abf1b3470e}</Project>
<Name>SafeExamBrowser.Settings</Name>
</ProjectReference>
<ProjectReference Include="..\SafeExamBrowser.SystemComponents.Contracts\SafeExamBrowser.SystemComponents.Contracts.csproj">
<Project>{903129c6-e236-493b-9ad6-c6a57f647a3a}</Project>
<Name>SafeExamBrowser.SystemComponents.Contracts</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@@ -0,0 +1,15 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* 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/.
*/
namespace SafeExamBrowser.UserInterface.Contracts.Shell.Events
{
/// <summary>
/// Event handler fired by an <see cref="IActionCenterActivator"/> to control the visibility of the <see cref="IActionCenter"/>.
/// </summary>
public delegate void ActivatorEventHandler();
}

View File

@@ -0,0 +1,17 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* 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.ComponentModel;
namespace SafeExamBrowser.UserInterface.Contracts.Shell.Events
{
/// <summary>
/// Event handler used to define the control flow when the <see cref="ITaskbar"/>'s quit button is clicked.
/// </summary>
public delegate void QuitButtonClickedEventHandler(CancelEventArgs args);
}

View File

@@ -0,0 +1,84 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* 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.I18n.Contracts;
using SafeExamBrowser.UserInterface.Contracts.Shell.Events;
namespace SafeExamBrowser.UserInterface.Contracts.Shell
{
/// <summary>
/// The action center is a user interface element via which the user can access and control various aspects of SEB.
/// </summary>
public interface IActionCenter
{
/// <summary>
/// Controls the visibility of the clock.
/// </summary>
bool ShowClock { set; }
/// <summary>
/// Controls the visibility of the quit button.
/// </summary>
bool ShowQuitButton { set; }
/// <summary>
/// Event fired when the user clicked the quit button.
/// </summary>
event QuitButtonClickedEventHandler QuitButtonClicked;
/// <summary>
/// Adds the given application control to the action center.
/// </summary>
void AddApplicationControl(IApplicationControl control, bool atFirstPosition = false);
/// <summary>
/// Adds the given notification control to the action center.
/// </summary>
void AddNotificationControl(INotificationControl control);
/// <summary>
/// Adds the given system control to the action center.
/// </summary>
void AddSystemControl(ISystemControl control);
/// <summary>
/// Closes the action center.
/// </summary>
void Close();
/// <summary>
/// Makes the action center invisible.
/// </summary>
void Hide();
/// <summary>
/// Moves the action center to the left of the screen and resizes it accordingly.
/// </summary>
void InitializeBounds();
/// <summary>
/// Initializes all text elements in the action center.
/// </summary>
void InitializeText(IText text);
/// <summary>
/// Makes the action center visible and automatically hides it after a short delay.
/// </summary>
void Promote();
/// <summary>
/// Registers the specified activator to control the visibility of the action center.
/// </summary>
void Register(IActionCenterActivator activator);
/// <summary>
/// Makes the action center visible.
/// </summary>
void Show();
}
}

View File

@@ -0,0 +1,33 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* 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.UserInterface.Contracts.Shell.Events;
namespace SafeExamBrowser.UserInterface.Contracts.Shell
{
/// <summary>
/// A module which can be used to control the <see cref="IActionCenter"/>.
/// </summary>
public interface IActionCenterActivator : IActivator
{
/// <summary>
/// Fired when the action center should be made visible.
/// </summary>
event ActivatorEventHandler Activated;
/// <summary>
/// Fired when the action center should be made invisible.
/// </summary>
event ActivatorEventHandler Deactivated;
/// <summary>
/// Fired when the action center visibility should be toggled.
/// </summary>
event ActivatorEventHandler Toggled;
}
}

View File

@@ -0,0 +1,36 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* 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/.
*/
namespace SafeExamBrowser.UserInterface.Contracts.Shell
{
/// <summary>
/// Defines an activator for a shell component.
/// </summary>
public interface IActivator
{
/// <summary>
/// Temporarily stops processing all user input.
/// </summary>
void Pause();
/// <summary>
/// Resumes processing user input.
/// </summary>
void Resume();
/// <summary>
/// Starts monitoring user input events.
/// </summary>
void Start();
/// <summary>
/// Stops monitoring user input events.
/// </summary>
void Stop();
}
}

View File

@@ -0,0 +1,17 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* 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/.
*/
namespace SafeExamBrowser.UserInterface.Contracts.Shell
{
/// <summary>
/// The control for an application which can be loaded into the shell.
/// </summary>
public interface IApplicationControl
{
}
}

View File

@@ -0,0 +1,17 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* 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/.
*/
namespace SafeExamBrowser.UserInterface.Contracts.Shell
{
/// <summary>
/// The control for a notification which can be loaded into the shell.
/// </summary>
public interface INotificationControl
{
}
}

View File

@@ -0,0 +1,21 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* 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/.
*/
namespace SafeExamBrowser.UserInterface.Contracts.Shell
{
/// <summary>
/// The control of a system component which can be loaded into the shell.
/// </summary>
public interface ISystemControl
{
/// <summary>
/// Closes the control and / or any associated user interface elements.
/// </summary>
void Close();
}
}

View File

@@ -0,0 +1,28 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* 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;
namespace SafeExamBrowser.UserInterface.Contracts.Shell
{
/// <summary>
/// The task view provides an overview of all currently running application instances.
/// </summary>
public interface ITaskview
{
/// <summary>
/// Adds the given application to the task view.
/// </summary>
void Add(IApplication<IApplicationWindow> application);
/// <summary>
/// Registers the specified activator for the task view.
/// </summary>
void Register(ITaskviewActivator activator);
}
}

View File

@@ -0,0 +1,33 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* 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.UserInterface.Contracts.Shell.Events;
namespace SafeExamBrowser.UserInterface.Contracts.Shell
{
/// <summary>
/// A module which can be used to control the <see cref="ITaskview"/>.
/// </summary>
public interface ITaskviewActivator : IActivator
{
/// <summary>
/// Fired when the task view should be hidden.
/// </summary>
event ActivatorEventHandler Deactivated;
/// <summary>
/// Fired when the task view should be made visible and the next application instance should be selected.
/// </summary>
event ActivatorEventHandler NextActivated;
/// <summary>
/// Fired when the task view should be made visible and the previous application instance should be selected.
/// </summary>
event ActivatorEventHandler PreviousActivated;
}
}

View File

@@ -0,0 +1,90 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* 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.Browser.Contracts.Events;
using SafeExamBrowser.I18n.Contracts;
using SafeExamBrowser.UserInterface.Contracts.Shell.Events;
namespace SafeExamBrowser.UserInterface.Contracts.Shell
{
/// <summary>
/// The taskbar is a user interface element via which the user can access and control various aspects of the application.
/// </summary>
public interface ITaskbar
{
/// <summary>
/// Controls the visibility of the clock.
/// </summary>
bool ShowClock { set; }
/// <summary>
/// Controls the visibility of the quit button.
/// </summary>
bool ShowQuitButton { set; }
/// <summary>
/// Event fired when the user clicked the quit button in the taskbar.
/// </summary>
event QuitButtonClickedEventHandler QuitButtonClicked;
/// <summary>
/// Event fired when the Taskbar wants to lose focus.
/// </summary>
event LoseFocusRequestedEventHandler LoseFocusRequested;
/// <summary>
/// Adds the given application control to the taskbar.
/// </summary>
void AddApplicationControl(IApplicationControl control, bool atFirstPosition = false);
/// <summary>
/// Adds the given notification control to the taskbar.
/// </summary>
void AddNotificationControl(INotificationControl control);
/// <summary>
/// Adds the given system control to the taskbar.
/// </summary>
void AddSystemControl(ISystemControl control);
/// <summary>
/// Closes the taskbar.
/// </summary>
void Close();
/// <summary>
/// Puts the focus on the taskbar.
/// </summary>
void Focus(bool forward = true);
/// <summary>
/// Returns the absolute height of the taskbar (i.e. in physical pixels).
/// </summary>
int GetAbsoluteHeight();
/// <summary>
/// Moves the taskbar to the bottom of the screen and resizes it accordingly.
/// </summary>
void InitializeBounds();
/// <summary>
/// Initializes all text elements in the taskbar.
/// </summary>
void InitializeText(IText text);
/// <summary>
/// Registers the specified activator for the taskbar.
/// </summary>
void Register(ITaskbarActivator activator);
/// <summary>
/// Shows the taskbar.
/// </summary>
void Show();
}
}

View File

@@ -0,0 +1,23 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* 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.UserInterface.Contracts.Shell.Events;
namespace SafeExamBrowser.UserInterface.Contracts.Shell
{
/// <summary>
/// A module which can be used to activate the <see cref="ITaskbar"/>.
/// </summary>
public interface ITaskbarActivator : IActivator
{
/// <summary>
/// Fired when the taskbar should be activated (i.e. put into focus).
/// </summary>
event ActivatorEventHandler Activated;
}
}

View File

@@ -0,0 +1,23 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* 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.UserInterface.Contracts.Shell.Events;
namespace SafeExamBrowser.UserInterface.Contracts.Shell
{
/// <summary>
/// A module which observes user input and indicates when the user would like to terminate SEB.
/// </summary>
public interface ITerminationActivator : IActivator
{
/// <summary>
/// Fired when a termination request has been detected.
/// </summary>
event ActivatorEventHandler Activated;
}
}

View File

@@ -0,0 +1,26 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* 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/.
*/
namespace SafeExamBrowser.UserInterface.Contracts.Shell
{
/// <summary>
/// Defines all possible locations of a user control in the shell.
/// </summary>
public enum Location
{
/// <summary>
/// A user control styled for and placed in the action center.
/// </summary>
ActionCenter,
/// <summary>
/// A user control styled for and placed in the taskbar.
/// </summary>
Taskbar
}
}

View File

@@ -0,0 +1,26 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* 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/.
*/
namespace SafeExamBrowser.UserInterface.Contracts.Windows.Data
{
/// <summary>
/// Defines the purpose of a <see cref="ICredentialsDialog"/>.
/// </summary>
public enum CredentialsDialogPurpose
{
/// <summary>
/// Credentials for generic purposes.
/// </summary>
Generic,
/// <summary>
/// Credentials for wireless network authentication.
/// </summary>
WirelessNetwork
}
}

View File

@@ -0,0 +1,31 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* 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/.
*/
namespace SafeExamBrowser.UserInterface.Contracts.Windows.Data
{
/// <summary>
/// Defines the user interaction result of an <see cref="ICredentialsDialog"/>.
/// </summary>
public class CredentialsDialogResult
{
/// <summary>
/// The password entered by the user, or <c>default(string)</c> if the interaction was unsuccessful.
/// </summary>
public string Password { get; set; }
/// <summary>
/// Indicates whether the user confirmed the dialog or not.
/// </summary>
public bool Success { get; set; }
/// <summary>
/// The username entered by the user, or <c>default(string)</c> if no username is required or the interaction was unsuccessful.
/// </summary>
public string Username { get; set; }
}
}

View File

@@ -0,0 +1,28 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* 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.Server.Contracts.Data;
namespace SafeExamBrowser.UserInterface.Contracts.Windows.Data
{
/// <summary>
/// Defines the user interaction result of an <see cref="IExamSelectionDialog"/>.
/// </summary>
public class ExamSelectionDialogResult
{
/// <summary>
/// The exam selected by the user.
/// </summary>
public Exam SelectedExam { get; set; }
/// <summary>
/// Indicates whether the user confirmed the dialog or not.
/// </summary>
public bool Success { get; set; }
}
}

View File

@@ -0,0 +1,33 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* 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;
namespace SafeExamBrowser.UserInterface.Contracts.Windows.Data
{
/// <summary>
/// Defines an option for the user to select on the <see cref="ILockScreen"/>.
/// </summary>
public class LockScreenOption
{
/// <summary>
/// The unique identifier for this option.
/// </summary>
public Guid Id { get; set; }
/// <summary>
/// The text to be displayed to the user.
/// </summary>
public string Text { get; set; }
public LockScreenOption()
{
Id = Guid.NewGuid();
}
}
}

View File

@@ -0,0 +1,33 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* 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;
namespace SafeExamBrowser.UserInterface.Contracts.Windows.Data
{
/// <summary>
/// Defines the result of a lock screen interaction by the user.
/// </summary>
public class LockScreenResult
{
/// <summary>
/// Indicates that the lock screen has been canceled (e.g. via a server instruction).
/// </summary>
public bool Canceled { get; set; }
/// <summary>
/// The identifier of the option selected by the user, if available.
/// </summary>
public Guid? OptionId { get; set; }
/// <summary>
/// The password entered by the user.
/// </summary>
public string Password { get; set; }
}
}

View File

@@ -0,0 +1,26 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* 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/.
*/
namespace SafeExamBrowser.UserInterface.Contracts.Windows.Data
{
/// <summary>
/// Defines the user interaction result of an <see cref="IPasswordDialog"/>.
/// </summary>
public class PasswordDialogResult
{
/// <summary>
/// The password entered by the user, or <c>null</c> if the interaction was unsuccessful.
/// </summary>
public string Password { get; set; }
/// <summary>
/// Indicates whether the user confirmed the dialog or not.
/// </summary>
public bool Success { get; set; }
}
}

View File

@@ -0,0 +1,36 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* 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/.
*/
namespace SafeExamBrowser.UserInterface.Contracts.Windows.Data
{
/// <summary>
/// Defines the user interaction result of an <see cref="IServerFailureDialog"/>.
/// </summary>
public class ServerFailureDialogResult
{
/// <summary>
/// Indicates whether the user wants to abort the operation.
/// </summary>
public bool Abort { get; set; }
/// <summary>
/// Indicates whether the user wants to performa a fallback.
/// </summary>
public bool Fallback { get; set; }
/// <summary>
/// Indicates whether the user wants to retry the operation.
/// </summary>
public bool Retry { get; set; }
/// <summary>
/// Indicates whether the user confirmed the dialog or not.
/// </summary>
public bool Success { get; set; }
}
}

View File

@@ -0,0 +1,15 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* 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/.
*/
namespace SafeExamBrowser.UserInterface.Contracts.Windows.Events
{
/// <summary>
/// Indicates that a window has been closed.
/// </summary>
public delegate void WindowClosedEventHandler();
}

View File

@@ -0,0 +1,15 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* 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/.
*/
namespace SafeExamBrowser.UserInterface.Contracts.Windows.Events
{
/// <summary>
/// Indicates that a window is about to be closed.
/// </summary>
public delegate void WindowClosingEventHandler();
}

View File

@@ -0,0 +1,23 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* 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.UserInterface.Contracts.Windows.Data;
namespace SafeExamBrowser.UserInterface.Contracts.Windows
{
/// <summary>
/// Defines the functionality of a dialog to retrieve user credentials.
/// </summary>
public interface ICredentialsDialog : IWindow
{
/// <summary>
/// Shows the dialog as topmost window. If a parent window is specified, the dialog is rendered modally for the given parent.
/// </summary>
CredentialsDialogResult Show(IWindow parent = null);
}
}

View File

@@ -0,0 +1,23 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* 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.UserInterface.Contracts.Windows.Data;
namespace SafeExamBrowser.UserInterface.Contracts.Windows
{
/// <summary>
/// The dialog shown to let the user select which server exam to start.
/// </summary>
public interface IExamSelectionDialog
{
/// <summary>
/// Shows the dialog as topmost window. If a parent window is specified, the dialog is rendered modally for the given parent.
/// </summary>
ExamSelectionDialogResult Show(IWindow parent = null);
}
}

View File

@@ -0,0 +1,33 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* 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.UserInterface.Contracts.Windows.Data;
namespace SafeExamBrowser.UserInterface.Contracts.Windows
{
/// <summary>
/// Defines the functionality of a lock screen which covers all active displays and prevents the user from continuing their work.
/// </summary>
public interface ILockScreen : IWindow
{
/// <summary>
/// Cancels the <see cref="WaitForResult"/> operation and closes the lock screen.
/// </summary>
void Cancel();
/// <summary>
/// Expands the lock screen across all active displays and resizes it accordingly.
/// </summary>
void InitializeBounds();
/// <summary>
/// Waits for the user to provide the required input to unlock the application.
/// </summary>
LockScreenResult WaitForResult();
}
}

View File

@@ -0,0 +1,23 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* 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.UserInterface.Contracts.Windows.Data;
namespace SafeExamBrowser.UserInterface.Contracts.Windows
{
/// <summary>
/// Defines the functionality of a password dialog.
/// </summary>
public interface IPasswordDialog : IWindow
{
/// <summary>
/// Shows the dialog as topmost window. If a parent window is specified, the dialog is rendered modally for the given parent.
/// </summary>
PasswordDialogResult Show(IWindow parent = null);
}
}

View File

@@ -0,0 +1,34 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* 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.Logging.Contracts;
namespace SafeExamBrowser.UserInterface.Contracts.Windows
{
/// <summary>
/// The main window of the runtime application component. It is controlled by the <see cref="Behaviour.IRuntimeController"/> and serves
/// first of all as progress indicator for the user (e.g. during application startup &amp; shutdown).
/// </summary>
public interface IRuntimeWindow : ILogObserver, IProgressIndicator, IWindow
{
/// <summary>
/// Determines whether the application log is visible.
/// </summary>
bool ShowLog { set; }
/// <summary>
/// Determines whether the progress bar is visible.
/// </summary>
bool ShowProgressBar { set; }
/// <summary>
/// Determines whether the window will stay on top of other windows.
/// </summary>
bool TopMost { set; }
}
}

View File

@@ -0,0 +1,23 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* 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.UserInterface.Contracts.Windows.Data;
namespace SafeExamBrowser.UserInterface.Contracts.Windows
{
/// <summary>
/// The dialog shown in case a communication failure with a server occurs.
/// </summary>
public interface IServerFailureDialog
{
/// <summary>
/// Shows the dialog as topmost window. If a parent window is specified, the dialog is rendered modally for the given parent.
/// </summary>
ServerFailureDialogResult Show(IWindow parent = null);
}
}

View File

@@ -0,0 +1,23 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* 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.Configuration.Contracts;
namespace SafeExamBrowser.UserInterface.Contracts.Windows
{
/// <summary>
/// Defines the functionality of a splash screen.
/// </summary>
public interface ISplashScreen : IProgressIndicator, IWindow
{
/// <summary>
/// The global configuration used to display version and copyright information. Can be updated during the execution of a procedure.
/// </summary>
AppConfig AppConfig { set; }
}
}

View File

@@ -0,0 +1,48 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* 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.UserInterface.Contracts.Windows.Events;
namespace SafeExamBrowser.UserInterface.Contracts.Windows
{
/// <summary>
/// Defines the functionality of a window.
/// </summary>
public interface IWindow
{
/// <summary>
/// Event fired when the window has been closed;
/// </summary>
event WindowClosedEventHandler Closed;
/// <summary>
/// Event fired when the window is closing.
/// </summary>
event WindowClosingEventHandler Closing;
/// <summary>
/// Brings the window to the foreground.
/// </summary>
void BringToForeground();
/// <summary>
/// Closes the window.
/// </summary>
void Close();
/// <summary>
/// Hides the window.
/// </summary>
void Hide();
/// <summary>
/// Shows the window to the user.
/// </summary>
void Show();
}
}