Skip to content

Commit 32fdafb

Browse files
committed
SEBWIN-1056: Implemented missing aspects, added English and German text and improved overlay layout.
1 parent 425ca80 commit 32fdafb

10 files changed

Lines changed: 97 additions & 31 deletions

File tree

SafeExamBrowser.Client/CompositionRoot.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ private IOperation BuildShellOperation()
356356
var audio = new Audio(context.Settings.Audio, ModuleLogger(nameof(Audio)));
357357
var keyboard = new Keyboard(ModuleLogger(nameof(Keyboard)));
358358
var logNotification = new LogNotification(logger, text, uiFactory);
359-
var verificator = new Verificator(context.AppConfig, context.IntegrityModule, ModuleLogger(nameof(Verificator)), messageBox, nativeMethods, systemInfo, uiFactory);
359+
var verificator = new Verificator(context.AppConfig, context.IntegrityModule, ModuleLogger(nameof(Verificator)), messageBox, nativeMethods, systemInfo, text, uiFactory);
360360
var verificatorNotification = new VerificatorNotification(text, verificator);
361361
var operation = new ShellOperation(
362362
actionCenter,

SafeExamBrowser.Client/Notifications/VerificatorNotification.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,7 @@ internal VerificatorNotification(IText text, IVerificator verificator)
3333
CanActivate = true;
3434
// TODO: Load icon once available!
3535
// IconResource = new BitmapIconResource { Uri = new Uri("pack://application:,,,/SafeExamBrowser.UserInterface.Desktop;component/Images/VerificatorNotification.ico") };
36-
37-
// TODO: Properly load text (see reference in issue)!
38-
Tooltip = "Show QR Code for Verificator App";
36+
Tooltip = text.Get(TextKey.Notification_VerificatorTooltip);
3937
}
4038

4139
public void Activate()

SafeExamBrowser.I18n.Contracts/TextKey.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,10 @@ public enum TextKey
169169
MessageBox_UnexpectedConfigurationErrorTitle,
170170
MessageBox_UploadNotAllowed,
171171
MessageBox_UploadNotAllowedTitle,
172+
MessageBox_VerificatorActivationLimit,
173+
MessageBox_VerificatorActivationLimitTitle,
174+
MessageBox_VerificatorMissingInternet,
175+
MessageBox_VerificatorMissingInternetTitle,
172176
MessageBox_VersionRestrictionError,
173177
MessageBox_VersionRestrictionErrorTitle,
174178
MessageBox_VersionRestrictionMinimum,
@@ -187,6 +191,7 @@ public enum TextKey
187191
Notification_ProctoringInactiveTooltip,
188192
Notification_ProctoringLowerHand,
189193
Notification_ProctoringRaiseHand,
194+
Notification_VerificatorTooltip,
190195
OperationStatus_CloseRuntimeConnection,
191196
OperationStatus_FinalizeApplications,
192197
OperationStatus_FinalizeClipboard,

SafeExamBrowser.I18n/Data/de.xml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,18 @@
465465
<Entry key="MessageBox_UploadNotAllowedTitle">
466466
Hochladen nicht erlaubt!
467467
</Entry>
468+
<Entry key="MessageBox_VerificatorActivationLimit">
469+
Bitte warten Sie aus Sicherheitsgründen bis um %%_RESUME_TIME_%% bevor Sie erneut versuchen, einen QR-Code zu generieren.
470+
</Entry>
471+
<Entry key="MessageBox_VerificatorActivationLimitTitle">
472+
Verifizierungslimite erreicht
473+
</Entry>
474+
<Entry key="MessageBox_VerificatorMissingInternet">
475+
Eine Verbindung zum Internet ist notwendig, um QR-Codes für die Verificator App generieren zu können.
476+
</Entry>
477+
<Entry key="MessageBox_VerificatorMissingInternetTitle">
478+
Keine Internetverbindung
479+
</Entry>
468480
<Entry key="MessageBox_VersionRestrictionError">
469481
Die installierte SEB-Version %%_VERSION_%% kann nicht verwendet werden, da die ausgewählte Konfiguration die Verwendung einer bestimmten Version erfordert:%%_REQUIRED_VERSIONS_%%Bitte laden Sie die erforderliche Version von der offiziellen Website (safeexambrowser.org/download) oder aus dem Repository von SEB für Windows auf GitHub (github.com/safeexambrowser) herunter und installieren Sie diese.
470482
</Entry>
@@ -519,6 +531,9 @@
519531
<Entry key="Notification_ProctoringRaiseHand">
520532
Hand erheben
521533
</Entry>
534+
<Entry key="Notification_VerificatorTooltip">
535+
QR-Code für die Verificator App generieren
536+
</Entry>
522537
<Entry key="OperationStatus_CloseRuntimeConnection">
523538
Schliesse Verbindung zur Runtime
524539
</Entry>

SafeExamBrowser.I18n/Data/en.xml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,18 @@
465465
<Entry key="MessageBox_UploadNotAllowedTitle">
466466
Uploading Not Allowed!
467467
</Entry>
468+
<Entry key="MessageBox_VerificatorActivationLimit">
469+
For security reasons, please wait until %%_RESUME_TIME_%% before attempting to generate a QR code again.
470+
</Entry>
471+
<Entry key="MessageBox_VerificatorActivationLimitTitle">
472+
Verification Limit Reached
473+
</Entry>
474+
<Entry key="MessageBox_VerificatorMissingInternet">
475+
A connection to the internet is required in order to generate QR codes for the Verificator App.
476+
</Entry>
477+
<Entry key="MessageBox_VerificatorMissingInternetTitle">
478+
No Internet Connection
479+
</Entry>
468480
<Entry key="MessageBox_VersionRestrictionError">
469481
The installed SEB version %%_VERSION_%% cannot be used as the selected configuration requires to use a specific version:%%_REQUIRED_VERSIONS_%%Please download and install the required version from the official website (safeexambrowser.org/download) or from the repository of SEB for Windows on GitHub (github.com/safeexambrowser).
470482
</Entry>
@@ -519,6 +531,9 @@
519531
<Entry key="Notification_ProctoringRaiseHand">
520532
Raise hand
521533
</Entry>
534+
<Entry key="Notification_VerificatorTooltip">
535+
Generate QR Code for Verificator App
536+
</Entry>
522537
<Entry key="OperationStatus_CloseRuntimeConnection">
523538
Closing runtime connection
524539
</Entry>

SafeExamBrowser.Integrity/Verificator.cs

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
using Newtonsoft.Json.Linq;
1414
using QRCoder;
1515
using SafeExamBrowser.Configuration.Contracts;
16+
using SafeExamBrowser.I18n.Contracts;
1617
using SafeExamBrowser.Integrity.Contracts;
1718
using SafeExamBrowser.Logging.Contracts;
1819
using SafeExamBrowser.SystemComponents.Contracts;
@@ -39,6 +40,7 @@ public class Verificator : IVerificator
3940
private readonly IMessageBox messageBox;
4041
private readonly INativeMethods nativeMethods;
4142
private readonly ISystemInfo systemInfo;
43+
private readonly IText text;
4244
private readonly IUserInterfaceFactory uiFactory;
4345

4446
private int activations;
@@ -52,6 +54,7 @@ public Verificator(
5254
IMessageBox messageBox,
5355
INativeMethods nativeMethods,
5456
ISystemInfo systemInfo,
57+
IText text,
5558
IUserInterfaceFactory uiFactory)
5659
{
5760
this.appConfig = appConfig;
@@ -61,6 +64,7 @@ public Verificator(
6164
this.messageBox = messageBox;
6265
this.nativeMethods = nativeMethods;
6366
this.systemInfo = systemInfo;
67+
this.text = text;
6468
this.uiFactory = uiFactory;
6569
}
6670

@@ -75,8 +79,6 @@ public void Activate()
7579
{
7680
CreateOverlay();
7781
GenerateCodes();
78-
79-
logger.Info("Activated code generation.");
8082
}
8183
else
8284
{
@@ -85,14 +87,11 @@ public void Activate()
8587
}
8688
else if (!canActivate)
8789
{
88-
logger.Info($"The activation limit was reached, code generation may resume at {lastActivation.Add(WAIT_TIME):T}.");
89-
// TODO: Properly load text (see reference in issue)!
90-
messageBox.Show($"The activation limit was reached, please wait until {lastActivation.Add(WAIT_TIME):T} to resume.", "Information");
90+
ShowActivationLimitMessage();
9191
}
9292
else
9393
{
94-
logger.Error("Cannot activate code generation due to missing internet connection!");
95-
// TODO: Show message box and properly load text (see reference in issue)!
94+
ShowMissingInternetMessage();
9695
}
9796
}
9897

@@ -170,6 +169,8 @@ private void GenerateCodes()
170169

171170
overlay?.Close();
172171
});
172+
173+
logger.Info("Activated code generation.");
173174
}
174175

175176
private string GeneratePayload()
@@ -198,7 +199,7 @@ private bool TryGenerateCode(string payload)
198199

199200
if (success)
200201
{
201-
using (var qrCode = QRCodeGenerator.GenerateQrCode(code, QRCodeGenerator.ECCLevel.L))
202+
using (var qrCode = QRCodeGenerator.GenerateQrCode(code, QRCodeGenerator.ECCLevel.Default))
202203
using (var bitmap = new BitmapByteQRCode(qrCode))
203204
{
204205
var bytes = bitmap.GetGraphic(32);
@@ -209,5 +210,21 @@ private bool TryGenerateCode(string payload)
209210

210211
return success;
211212
}
213+
214+
private void ShowActivationLimitMessage()
215+
{
216+
var resumeTime = lastActivation.Add(WAIT_TIME).ToString("T");
217+
var message = text.Get(TextKey.MessageBox_VerificatorActivationLimit).Replace("%%_RESUME_TIME_%%", resumeTime);
218+
var title = text.Get(TextKey.MessageBox_VerificatorActivationLimitTitle);
219+
220+
logger.Info($"The activation limit was reached, code generation may resume at {resumeTime}.");
221+
messageBox.Show(message, title);
222+
}
223+
224+
private void ShowMissingInternetMessage()
225+
{
226+
logger.Error("Cannot activate code generation due to missing internet connection!");
227+
messageBox.Show(TextKey.MessageBox_VerificatorMissingInternet, TextKey.MessageBox_VerificatorMissingInternetTitle);
228+
}
212229
}
213230
}

SafeExamBrowser.UserInterface.Desktop/Windows/VerificatorOverlay.xaml

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,19 @@
1313
<Grid>
1414
<Grid.RowDefinitions>
1515
<RowDefinition Height="*" />
16-
<RowDefinition Height="5*" />
16+
<RowDefinition Height="6*" />
1717
<RowDefinition Height="*" />
1818
</Grid.RowDefinitions>
19-
<Viewbox Grid.Row="1" Stretch="Uniform">
20-
<Grid Background="White">
21-
<StackPanel Name="Loading" Margin="200" VerticalAlignment="Center" >
22-
<fa:ImageAwesome Foreground="LightGray" Icon="Cog" Margin="0,20" Spin="True" SpinDuration="2" />
23-
<ProgressBar BorderThickness="0" Height="10" IsIndeterminate="True" Width="150" />
24-
</StackPanel>
25-
<Image Name="Code" />
26-
</Grid>
27-
</Viewbox>
19+
<Border Grid.Row="1" Name="Container" Background="White" BorderThickness="0" CornerRadius="10" Padding="5">
20+
<Viewbox Stretch="Uniform">
21+
<Grid>
22+
<StackPanel Name="Loading" Margin="200" VerticalAlignment="Center" >
23+
<fa:ImageAwesome Foreground="LightGray" Icon="Cog" Margin="0,20" Spin="True" SpinDuration="2" />
24+
<ProgressBar BorderThickness="0" Height="10" IsIndeterminate="True" Width="150" />
25+
</StackPanel>
26+
<Image Name="Code" />
27+
</Grid>
28+
</Viewbox>
29+
</Border>
2830
</Grid>
2931
</Window>

SafeExamBrowser.UserInterface.Desktop/Windows/VerificatorOverlay.xaml.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ private void InitializeVerificatorOverlay()
8787
Closed += (o, args) => closed?.Invoke();
8888
Closing += (o, args) => closing?.Invoke();
8989
KeyDown += VerificatorOverlay_KeyDown;
90+
Loaded += VerificatorOverlay_Loaded;
9091
MouseDown += (o, args) => Close();
9192
}
9293

@@ -103,5 +104,10 @@ private void VerificatorOverlay_KeyDown(object sender, KeyEventArgs e)
103104
Close();
104105
}
105106
}
107+
108+
private void VerificatorOverlay_Loaded(object sender, RoutedEventArgs e)
109+
{
110+
Container.Width = Container.ActualHeight;
111+
}
106112
}
107113
}

SafeExamBrowser.UserInterface.Mobile/Windows/VerificatorOverlay.xaml

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,16 @@
1616
<RowDefinition Height="5*" />
1717
<RowDefinition Height="*" />
1818
</Grid.RowDefinitions>
19-
<Viewbox Grid.Row="1" Stretch="Uniform">
20-
<Grid Background="White">
21-
<StackPanel Name="Loading" Margin="200" VerticalAlignment="Center" >
22-
<fa:ImageAwesome Foreground="LightGray" Icon="Cog" Margin="0,20" Spin="True" SpinDuration="2" />
23-
<ProgressBar BorderThickness="0" Height="10" IsIndeterminate="True" Width="150" />
24-
</StackPanel>
25-
<Image Name="Code" />
26-
</Grid>
27-
</Viewbox>
19+
<Border Grid.Row="1" Name="Container" Background="White" BorderThickness="0" CornerRadius="10" Padding="5">
20+
<Viewbox Stretch="Uniform">
21+
<Grid>
22+
<StackPanel Name="Loading" Margin="200" VerticalAlignment="Center" >
23+
<fa:ImageAwesome Foreground="LightGray" Icon="Cog" Margin="0,20" Spin="True" SpinDuration="2" />
24+
<ProgressBar BorderThickness="0" Height="10" IsIndeterminate="True" Width="150" />
25+
</StackPanel>
26+
<Image Name="Code" />
27+
</Grid>
28+
</Viewbox>
29+
</Border>
2830
</Grid>
2931
</Window>

SafeExamBrowser.UserInterface.Mobile/Windows/VerificatorOverlay.xaml.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ private void InitializeVerificatorOverlay()
8787
Closed += (o, args) => closed?.Invoke();
8888
Closing += (o, args) => closing?.Invoke();
8989
KeyDown += VerificatorOverlay_KeyDown;
90+
Loaded += VerificatorOverlay_Loaded;
9091
MouseDown += (o, args) => Close();
9192
}
9293

@@ -103,5 +104,10 @@ private void VerificatorOverlay_KeyDown(object sender, KeyEventArgs e)
103104
Close();
104105
}
105106
}
107+
108+
private void VerificatorOverlay_Loaded(object sender, RoutedEventArgs e)
109+
{
110+
Container.Width = Container.ActualHeight;
111+
}
106112
}
107113
}

0 commit comments

Comments
 (0)