Update Safe Exam Browser Patch to 3.10.0.826
This commit is contained in:
@@ -96,12 +96,12 @@ namespace SafeExamBrowser.UserInterface.Desktop.Windows
|
||||
|
||||
public void Promote()
|
||||
{
|
||||
//Task.Run(() =>
|
||||
//{
|
||||
// Dispatcher.Invoke(ShowAnimated);
|
||||
// Thread.Sleep(2000);
|
||||
// Dispatcher.Invoke(HideAnimated);
|
||||
//});
|
||||
Task.Run(() =>
|
||||
{
|
||||
Dispatcher.Invoke(ShowAnimated);
|
||||
Thread.Sleep(2000);
|
||||
Dispatcher.Invoke(HideAnimated);
|
||||
});
|
||||
}
|
||||
|
||||
public void Register(IActionCenterActivator activator)
|
||||
|
@@ -44,10 +44,14 @@
|
||||
</WrapPanel>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Grid Grid.Row="1" Name="ButtonPanel" Background="{StaticResource BackgroundBrush}">
|
||||
<StackPanel Grid.Row="1" Name="ButtonPanel" Background="{StaticResource BackgroundBrush}" Orientation="Vertical">
|
||||
<StackPanel Grid.Row="1" Name="PasswordPanel" Margin="20,20,20,0" Orientation="Vertical">
|
||||
<TextBlock Name="PasswordLabel" Margin="0,0,0,5" />
|
||||
<PasswordBox Name="Password" Height="25" VerticalContentAlignment="Center" />
|
||||
</StackPanel>
|
||||
<WrapPanel Orientation="Horizontal" Margin="20" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Button Name="Button" Cursor="Hand" Padding="10,5" MinWidth="75" />
|
||||
</WrapPanel>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Window>
|
||||
|
@@ -11,25 +11,52 @@ using System.Windows.Input;
|
||||
using SafeExamBrowser.I18n.Contracts;
|
||||
using SafeExamBrowser.Proctoring.Contracts.Events;
|
||||
using SafeExamBrowser.UserInterface.Contracts.Proctoring;
|
||||
using SafeExamBrowser.UserInterface.Contracts.Proctoring.Events;
|
||||
using SafeExamBrowser.UserInterface.Contracts.Windows;
|
||||
using SafeExamBrowser.UserInterface.Contracts.Windows.Events;
|
||||
using SafeExamBrowser.UserInterface.Shared.Utilities;
|
||||
|
||||
namespace SafeExamBrowser.UserInterface.Desktop.Windows
|
||||
{
|
||||
public partial class ProctoringFinalizationDialog : Window, IProctoringFinalizationDialog
|
||||
{
|
||||
private readonly bool requiresPassword;
|
||||
private readonly IText text;
|
||||
|
||||
private bool cancellationRequested;
|
||||
private WindowClosedEventHandler closed;
|
||||
private WindowClosingEventHandler closing;
|
||||
private bool initialized;
|
||||
|
||||
public ProctoringFinalizationDialog(IText text)
|
||||
public string QuitPassword => Password.Password;
|
||||
|
||||
public event CancellationRequestedEventHandler CancellationRequested;
|
||||
|
||||
event WindowClosedEventHandler IWindow.Closed
|
||||
{
|
||||
add { closed += value; }
|
||||
remove { closed -= value; }
|
||||
}
|
||||
|
||||
event WindowClosingEventHandler IWindow.Closing
|
||||
{
|
||||
add { closing += value; }
|
||||
remove { closing -= value; }
|
||||
}
|
||||
|
||||
public ProctoringFinalizationDialog(bool requiresPassword, IText text)
|
||||
{
|
||||
this.requiresPassword = requiresPassword;
|
||||
this.text = text;
|
||||
|
||||
InitializeComponent();
|
||||
InitializeDialog();
|
||||
}
|
||||
|
||||
public void BringToForeground()
|
||||
{
|
||||
Dispatcher.Invoke(Activate);
|
||||
}
|
||||
|
||||
public new void Show()
|
||||
{
|
||||
Dispatcher.Invoke(() => ShowDialog());
|
||||
@@ -54,17 +81,38 @@ namespace SafeExamBrowser.UserInterface.Desktop.Windows
|
||||
});
|
||||
}
|
||||
|
||||
private void InitializeCancellation()
|
||||
{
|
||||
Button.Click += Button_Click;
|
||||
Button.Content = text.Get(TextKey.ProctoringFinalizationDialog_Abort);
|
||||
|
||||
if (requiresPassword)
|
||||
{
|
||||
PasswordPanel.Visibility = Visibility.Visible;
|
||||
PasswordLabel.Text = text.Get(TextKey.ProctoringFinalizationDialog_PasswordMessage);
|
||||
Password.KeyDown += Password_KeyDown;
|
||||
Password.Focus();
|
||||
|
||||
Height += PasswordPanel.ActualHeight + PasswordPanel.Margin.Top + PasswordPanel.Margin.Bottom;
|
||||
}
|
||||
initialized = true;
|
||||
}
|
||||
|
||||
private void InitializeDialog()
|
||||
{
|
||||
Closed += (o, args) => closed?.Invoke();
|
||||
Closing += (o, args) => closing?.Invoke();
|
||||
Loaded += (o, args) => this.DisableCloseButton();
|
||||
Title = text.Get(TextKey.ProctoringFinalizationDialog_Title);
|
||||
}
|
||||
|
||||
private void ShowFailure(RemainingWorkUpdatedEventArgs status)
|
||||
{
|
||||
ButtonPanel.Visibility = Visibility.Visible;
|
||||
Button.Click -= Button_Click;
|
||||
Button.Click += (o, args) => Close();
|
||||
Button.Content = text.Get(TextKey.ProctoringFinalizationDialog_Confirm);
|
||||
ButtonPanel.Visibility = Visibility.Visible;
|
||||
Button.Focus();
|
||||
|
||||
// TODO: Revert once cache handling has been specified and changed!
|
||||
CachePath.Text = status.CachePath ?? "-";
|
||||
@@ -72,7 +120,9 @@ namespace SafeExamBrowser.UserInterface.Desktop.Windows
|
||||
|
||||
Cursor = Cursors.Arrow;
|
||||
FailurePanel.Visibility = Visibility.Visible;
|
||||
Height -= PasswordPanel.IsVisible ? PasswordPanel.ActualHeight + PasswordPanel.Margin.Top + PasswordPanel.Margin.Bottom : 0;
|
||||
Message.Text = text.Get(TextKey.ProctoringFinalizationDialog_FailureMessage);
|
||||
PasswordPanel.Visibility = Visibility.Collapsed;
|
||||
ProgressPanel.Visibility = Visibility.Collapsed;
|
||||
|
||||
this.EnableCloseButton();
|
||||
@@ -88,9 +138,11 @@ namespace SafeExamBrowser.UserInterface.Desktop.Windows
|
||||
|
||||
if (status.AllowCancellation && !initialized)
|
||||
{
|
||||
Button.Click += (o, args) => cancellationRequested = true;
|
||||
Button.Content = text.Get(TextKey.ProctoringFinalizationDialog_Abort);
|
||||
initialized = true;
|
||||
InitializeCancellation();
|
||||
}
|
||||
else if (!status.AllowCancellation)
|
||||
{
|
||||
PasswordPanel.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
|
||||
if (status.IsWaiting)
|
||||
@@ -101,8 +153,6 @@ namespace SafeExamBrowser.UserInterface.Desktop.Windows
|
||||
{
|
||||
UpdateProgress(status);
|
||||
}
|
||||
|
||||
status.CancellationRequested = cancellationRequested;
|
||||
}
|
||||
|
||||
private void UpdateProgress(RemainingWorkUpdatedEventArgs status)
|
||||
@@ -144,5 +194,18 @@ namespace SafeExamBrowser.UserInterface.Desktop.Windows
|
||||
Status.Text = text.Get(TextKey.ProctoringFinalizationDialog_StatusWaiting).Replace("%%_COUNT_%%", count);
|
||||
}
|
||||
}
|
||||
|
||||
private void Button_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
CancellationRequested?.Invoke();
|
||||
}
|
||||
|
||||
private void Password_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Key == Key.Enter)
|
||||
{
|
||||
CancellationRequested?.Invoke();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user