forked from SafeExamBrowser/seb-win-refactoring
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUserInterfaceFactory.cs
More file actions
180 lines (151 loc) · 5.98 KB
/
UserInterfaceFactory.cs
File metadata and controls
180 lines (151 loc) · 5.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
/*
* Copyright (c) 2026 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 System.Windows.Media;
using FontAwesome.WPF;
using SafeExamBrowser.Applications.Contracts;
using SafeExamBrowser.Configuration.Contracts;
using SafeExamBrowser.Core.Contracts.Notifications;
using SafeExamBrowser.I18n.Contracts;
using SafeExamBrowser.Logging.Contracts;
using SafeExamBrowser.Server.Contracts;
using SafeExamBrowser.Server.Contracts.Data;
using SafeExamBrowser.Settings.Browser;
using SafeExamBrowser.Settings.Server;
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;
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.Desktop
{
public class UserInterfaceFactory : IUserInterfaceFactory
{
private readonly ControlFactory controlFactory;
private readonly IText text;
private readonly WindowFactory windowFactory;
/// <remarks>
/// The <see cref="IWindowGuard"/> is optional, as it is only used by the client application component.
/// </remarks>
public UserInterfaceFactory(IText text, IWindowGuard windowGuard = default)
{
this.controlFactory = new ControlFactory(text);
this.text = text;
this.windowFactory = new WindowFactory(text, windowGuard);
InitializeFontAwesome();
}
public IWindow CreateAboutWindow(AppConfig appConfig)
{
return windowFactory.CreateAboutWindow(appConfig);
}
public IActionCenter CreateActionCenter()
{
return windowFactory.CreateActionCenter();
}
public IApplicationControl CreateApplicationControl(IApplication<IApplicationWindow> application, Location location)
{
return controlFactory.CreateApplicationControl(application, location);
}
public ISystemControl CreateAudioControl(IAudio audio, Location location)
{
return controlFactory.CreateAudioControl(audio, location);
}
public IBrowserWindow CreateBrowserWindow(IBrowserControl control, BrowserSettings settings, bool isMainWindow, ILogger logger)
{
return windowFactory.CreateBrowserWindow(control, settings, isMainWindow, logger);
}
public ICredentialsDialog CreateCredentialsDialog(CredentialsDialogPurpose purpose, string message, string title)
{
return windowFactory.CreateCredentialsDialog(purpose, message, title);
}
public IExamSelectionDialog CreateExamSelectionDialog(IEnumerable<Exam> exams)
{
return windowFactory.CreateExamSelectionDialog(exams);
}
public ISystemControl CreateKeyboardLayoutControl(IKeyboard keyboard, Location location)
{
return controlFactory.CreateKeyboardLayoutControl(keyboard, location);
}
public ILockScreen CreateLockScreen(string message, string title, IEnumerable<LockScreenOption> options, LockScreenSettings settings)
{
return windowFactory.CreateLockScreen(message, title, options, settings);
}
public IWindow CreateLogWindow(ILogger logger)
{
return windowFactory.CreateLogWindow(logger);
}
public ISystemControl CreateNetworkControl(INetworkAdapter adapter, Location location)
{
return controlFactory.CreateNetworkControl(adapter, location);
}
public INotificationControl CreateNotificationControl(INotification notification, Location location)
{
return controlFactory.CreateNotificationControl(notification, location);
}
public IPasswordDialog CreatePasswordDialog(string message, string title)
{
return windowFactory.CreatePasswordDialog(message, title);
}
public IPasswordDialog CreatePasswordDialog(TextKey message, TextKey title)
{
return windowFactory.CreatePasswordDialog(text.Get(message), text.Get(title));
}
public ISystemControl CreatePowerSupplyControl(IPowerSupply powerSupply, Location location)
{
return controlFactory.CreatePowerSupplyControl(powerSupply, location);
}
public IProctoringFinalizationDialog CreateProctoringFinalizationDialog(bool requiresPassword)
{
return windowFactory.CreateProctoringFinalizationDialog(requiresPassword);
}
public IProctoringWindow CreateProctoringWindow(IProctoringControl control)
{
return windowFactory.CreateProctoringWindow(control);
}
public INotificationControl CreateRaiseHandControl(IInvigilator invigilator, Location location, InvigilationSettings settings)
{
return controlFactory.CreateRaiseHandControl(invigilator, location, settings);
}
public IRuntimeWindow CreateRuntimeWindow(AppConfig appConfig)
{
return windowFactory.CreateRuntimeWindow(appConfig);
}
public IServerFailureDialog CreateServerFailureDialog(string info, bool showFallback)
{
return windowFactory.CreateServerFailureDialog(info, showFallback);
}
public ISplashScreen CreateSplashScreen(AppConfig appConfig = null)
{
return windowFactory.CreateSplashScreen(appConfig);
}
public ITaskbar CreateTaskbar(ILogger logger)
{
return windowFactory.CreateTaskbar(logger);
}
public ITaskview CreateTaskview()
{
return windowFactory.CreateTaskview();
}
public IVerificatorOverlay CreateVerificatorOverlay()
{
return windowFactory.CreateVerificatorOverlay();
}
private void InitializeFontAwesome()
{
// To be able to use FontAwesome in XAML icon resources, we need to make sure that the FontAwesome.WPF assembly is loaded into
// the AppDomain before attempting to load an icon resource - thus the creation of an unused image below...
ImageAwesome.CreateImageSource(FontAwesomeIcon.FontAwesome, Brushes.Black);
}
}
}