Restore SEBPatch

This commit is contained in:
2025-06-01 11:56:28 +02:00
parent 8c656e3137
commit 00707825b4
1009 changed files with 5005 additions and 6502 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
* Copyright (c) 2025 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

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
* Copyright (c) 2025 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

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
* Copyright (c) 2025 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

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
* Copyright (c) 2025 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

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
* Copyright (c) 2025 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

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
* Copyright (c) 2025 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

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
* Copyright (c) 2025 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

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
* Copyright (c) 2025 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

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
* Copyright (c) 2025 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

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
* Copyright (c) 2025 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

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
* Copyright (c) 2025 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

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
* Copyright (c) 2025 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

View File

@@ -17,6 +17,6 @@
<ContentControl Grid.Row="0" Grid.RowSpan="2" Grid.Column="0" Panel.ZIndex="2" Name="Icon" Margin="10" Width="25" />
<ProgressBar Grid.Row="0" Grid.RowSpan="2" Grid.Column="0" Grid.ColumnSpan="2" Panel.ZIndex="1" Name="Progress" BorderThickness="0" />
<TextBlock Grid.Row="0" Grid.Column="1" Panel.ZIndex="2" Name="ItemName" FontWeight="Bold" Margin="0,10,10,0" />
<TextBlock Grid.Row="1" Grid.Column="1" Panel.ZIndex="2" Name="Status" FontStyle="Italic" Margin="0,0,10,10" />
<TextBlock Grid.Row="1" Grid.Column="1" Panel.ZIndex="2" Name="Status" Margin="0,0,10,10" />
</Grid>
</UserControl>

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
* Copyright (c) 2025 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
@@ -17,7 +17,7 @@ namespace SafeExamBrowser.UserInterface.Desktop.Controls.Browser
{
internal partial class DownloadItemControl : UserControl
{
private IText text;
private readonly IText text;
internal Guid Id { get; }
@@ -31,26 +31,75 @@ namespace SafeExamBrowser.UserInterface.Desktop.Controls.Browser
internal void Update(DownloadItemState state)
{
ItemName.Text = Uri.TryCreate(state.Url, UriKind.Absolute, out var uri) ? Path.GetFileName(uri.AbsolutePath) : state.Url;
Progress.Value = state.Completion * 100;
Status.Text = $"{text.Get(TextKey.BrowserWindow_Downloading)} ({state.Completion * 100}%)";
if (File.Exists(state.FullPath))
{
ItemName.Text = Path.GetFileName(state.FullPath);
Icon.Content = new Image { Source = IconLoader.LoadIconFor(new FileInfo(state.FullPath)) };
}
InitializeIcon(state);
InitializeName(state);
if (state.IsCancelled)
{
Progress.Visibility = System.Windows.Visibility.Collapsed;
Status.Text = text.Get(TextKey.BrowserWindow_DownloadCancelled);
ShowCancelled();
}
else if (state.IsComplete)
{
Progress.Visibility = System.Windows.Visibility.Collapsed;
Status.Text = text.Get(TextKey.BrowserWindow_DownloadComplete);
ShowCompleted(state);
}
else
{
ShowProgress(state);
}
}
private string BuildSizeInfo(DownloadItemState state)
{
return state.Size > 1000000 ? $"{state.Size / 1000000.0:N1} MB" : $"{state.Size / 1000.0:N1} kB";
}
private void InitializeIcon(DownloadItemState state)
{
if (Icon.Content == default && File.Exists(state.FullPath))
{
Icon.Content = new Image { Source = IconLoader.LoadIconFor(new FileInfo(state.FullPath)) };
}
}
private void InitializeName(DownloadItemState state)
{
var fileName = Path.GetFileName(state.FullPath);
if (ItemName.Text != fileName && File.Exists(state.FullPath))
{
ItemName.Text = fileName;
}
else if (string.IsNullOrEmpty(ItemName.Text))
{
ItemName.Text = Uri.TryCreate(state.Url, UriKind.Absolute, out var uri) ? Path.GetFileName(uri.AbsolutePath) : state.Url;
}
}
private void ShowCancelled()
{
Progress.IsIndeterminate = false;
Progress.Visibility = System.Windows.Visibility.Collapsed;
Status.Text = text.Get(TextKey.BrowserWindow_DownloadCancelled);
}
private void ShowCompleted(DownloadItemState state)
{
Progress.IsIndeterminate = false;
Progress.Visibility = System.Windows.Visibility.Collapsed;
Status.Text = $"{BuildSizeInfo(state)} — {text.Get(TextKey.BrowserWindow_DownloadComplete)}";
if (File.Exists(state.FullPath))
{
Icon.Content = new Image { Source = IconLoader.LoadIconFor(new FileInfo(state.FullPath)) };
ItemName.Text = Path.GetFileName(state.FullPath);
}
}
private void ShowProgress(DownloadItemState state)
{
Progress.IsIndeterminate = state.IsIndeterminate;
Progress.Value = state.Completion * 100;
Status.Text = $"{BuildSizeInfo(state)} — {text.Get(TextKey.BrowserWindow_Downloading)}{(state.IsIndeterminate ? "" : $" ({state.Completion * 100}%)")}";
}
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
* Copyright (c) 2025 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

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
* Copyright (c) 2025 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

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
* Copyright (c) 2025 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

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
* Copyright (c) 2025 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

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
* Copyright (c) 2025 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

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
* Copyright (c) 2025 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

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
* Copyright (c) 2025 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

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
* Copyright (c) 2025 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

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
* Copyright (c) 2025 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

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
* Copyright (c) 2025 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

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
* Copyright (c) 2025 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

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
* Copyright (c) 2025 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

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
* Copyright (c) 2025 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

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
* Copyright (c) 2025 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

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
* Copyright (c) 2025 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

View File

@@ -9,7 +9,7 @@ using System.Windows;
[assembly: AssemblyDescription("Safe Exam Browser")]
[assembly: AssemblyCompany("ETH Zürich")]
[assembly: AssemblyProduct("SafeExamBrowser.UserInterface.Desktop")]
[assembly: AssemblyCopyright("Copyright © 2024 ETH Zürich, IT Services")]
[assembly: AssemblyCopyright("Copyright © 2025 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
@@ -46,6 +46,6 @@ using System.Windows;
// 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("3.8.0.742")]
[assembly: AssemblyFileVersion("3.8.0.742")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0.0")]

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
* Copyright (c) 2025 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

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
* Copyright (c) 2025 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

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
* Copyright (c) 2025 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

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
* Copyright (c) 2025 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

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
* Copyright (c) 2025 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

View File

@@ -30,52 +30,57 @@
<LineBreak />
<Bold><Underline>.NET Framework</Underline></Bold>
<LineBreak />
Copyright © 2002-2024 Microsoft. All rights reserved.
Copyright © 2002-2025 Microsoft. All rights reserved.
<LineBreak />
<LineBreak />
<Bold><Underline>Bouncy Castle</Underline></Bold>
<LineBreak />
Copyright © 2000-2025 Legion of the Bouncy Castle Inc. All rights reserved.
<LineBreak />
<LineBreak />
<Bold><Underline>CefSharp (.NET bindings for the Chromium Embedded Framework)</Underline></Bold>
<LineBreak />
Copyright © 2010-2024 The CefSharp Authors. All rights reserved.
Copyright © 2010-2025 The CefSharp Authors. All rights reserved.
<LineBreak />
<LineBreak />
<Bold><Underline>CEF (Chromium Embedded Framework)</Underline></Bold>
<LineBreak />
Copyright © 2008-2024 The Chromium Embedded Framework Authors. All rights reserved.
Copyright © 2008-2025 The Chromium Embedded Framework Authors. All rights reserved.
<LineBreak />
<LineBreak />
<Bold><Underline>Font-Awesome-WPF</Underline></Bold>
<LineBreak />
Copyright © 2014-2024 charri. All rights reserved.
Copyright © 2014-2025 charri. All rights reserved.
<LineBreak />
<LineBreak />
<Bold><Underline>KGy SOFT Core &amp; Drawing Libraries</Underline></Bold>
<LineBreak />
Copyright © 2005-2024 KGy SOFT. All rights reserved.
Copyright © 2005-2025 KGy SOFT. All rights reserved.
<LineBreak />
<LineBreak />
<Bold><Underline>KnownFolders</Underline></Bold>
<LineBreak />
Copyright © 2017-2024 Syroot. All rights reserved.
Copyright © 2017-2025 Syroot. All rights reserved.
<LineBreak />
<LineBreak />
<Bold><Underline>Microsoft.Windows.SDK.Contracts</Underline></Bold>
<LineBreak />
Copyright © 2019-2024 Microsoft. All rights reserved.
Copyright © 2019-2025 Microsoft. All rights reserved.
<LineBreak />
<LineBreak />
<Bold><Underline>NAudio</Underline></Bold>
<LineBreak />
Copyright © 2008-2024 Mark Heath &amp; contributors. All rights reserved.
Copyright © 2008-2025 Mark Heath &amp; contributors. All rights reserved.
<LineBreak />
<LineBreak />
<Bold><Underline>Newtonsoft.Json</Underline></Bold>
<LineBreak />
Copyright © 2007-2024 James Newton-King. All rights reserved.
Copyright © 2007-2025 James Newton-King. All rights reserved.
<LineBreak />
<LineBreak />
<Bold><Underline>Visual C++ Redistributable</Underline></Bold>
<LineBreak />
Copyright © 1993-2024 Microsoft. All rights reserved.
Copyright © 1993-2025 Microsoft. All rights reserved.
</TextBlock>
</ScrollViewer>
</Grid>

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
* Copyright (c) 2025 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

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
* Copyright (c) 2025 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
@@ -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)

View File

@@ -4,6 +4,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:fa="http://schemas.fontawesome.io/icons/"
xmlns:local="clr-namespace:SafeExamBrowser.UserInterface.Desktop.Controls"
mc:Ignorable="d" Background="#FFF0F0F0" Height="500" Width="750" MinHeight="250" MinWidth="250" Icon="../Images/SafeExamBrowser.ico">
<Window.Resources>
<ResourceDictionary>

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
* Copyright (c) 2025 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
@@ -8,8 +8,10 @@
using System;
using System.ComponentModel;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Input;
using System.Windows.Interop;
@@ -42,8 +44,8 @@ namespace SafeExamBrowser.UserInterface.Desktop.Windows
private WindowClosedEventHandler closed;
private WindowClosingEventHandler closing;
private bool browserControlGetsFocusFromTaskbar = false;
private IInputElement tabKeyDownFocusElement = null;
private bool browserControlGetsFocusFromTaskbar;
private IInputElement tabKeyDownFocusElement;
private WindowSettings WindowSettings
{
@@ -65,7 +67,6 @@ namespace SafeExamBrowser.UserInterface.Desktop.Windows
public event ActionRequestedEventHandler ZoomOutRequested;
public event ActionRequestedEventHandler ZoomResetRequested;
public event LoseFocusRequestedEventHandler LoseFocusRequested;
internal event TerminationRequestedEventHandler TerminationRequested;
event WindowClosedEventHandler IWindow.Closed
{
@@ -198,27 +199,15 @@ namespace SafeExamBrowser.UserInterface.Desktop.Windows
{
Dispatcher.InvokeAsync(() =>
{
var isNewItem = true;
var control = Downloads.Children.OfType<DownloadItemControl>().FirstOrDefault(c => c.Id == state.Id);
foreach (var child in Downloads.Children)
if (control == default)
{
if (child is DownloadItemControl control && control.Id == state.Id)
{
control.Update(state);
isNewItem = false;
break;
}
}
if (isNewItem)
{
var control = new DownloadItemControl(state.Id, text);
control.Update(state);
control = new DownloadItemControl(state.Id, text);
Downloads.Children.Add(control);
}
control.Update(state);
DownloadsButton.Visibility = Visibility.Visible;
DownloadsPopup.IsOpen = IsActive;
});
@@ -253,8 +242,10 @@ namespace SafeExamBrowser.UserInterface.Desktop.Windows
{
if (isMainWindow)
{
//e.Cancel = true;
Dispatcher.Invoke(() =>
{
Closing -= BrowserWindow_Closing;
closing?.Invoke();
base.Close();
});
@@ -263,16 +254,6 @@ namespace SafeExamBrowser.UserInterface.Desktop.Windows
{
closing?.Invoke();
}
/*
if (isMainWindow)
{
e.Cancel = true;
}
else
{
closing?.Invoke();
}
*/
}
private void BrowserWindow_KeyDown(object sender, KeyEventArgs e)
@@ -341,10 +322,8 @@ namespace SafeExamBrowser.UserInterface.Desktop.Windows
else if (MenuPopup.IsKeyboardFocusWithin)
{
var focusedElement = FocusManager.GetFocusedElement(this);
var focusedControl = focusedElement as System.Windows.Controls.Control;
var prevFocusedControl = tabKeyDownFocusElement as System.Windows.Controls.Control;
if (focusedControl != null && prevFocusedControl != null)
if (focusedElement is Control focusedControl && tabKeyDownFocusElement is Control prevFocusedControl)
{
if (!hasShift && focusedControl.TabIndex < prevFocusedControl.TabIndex)
{
@@ -540,34 +519,31 @@ if (typeof __SEB_focusElement === 'undefined') {
private void ApplySettings()
{
BackwardButton.IsEnabled = true;
BackwardButton.Visibility = Visibility.Visible;
DeveloperConsoleMenuItem.Visibility = Visibility.Visible;
FindMenuItem.Visibility =Visibility.Visible;
ForwardButton.IsEnabled = true;
ForwardButton.Visibility = Visibility.Visible;
HomeButton.IsEnabled = true;
HomeButton.Visibility = Visibility.Visible;
ReloadButton.IsEnabled = true;
ReloadButton.Visibility = Visibility.Visible;
Toolbar.Visibility = Visibility.Visible;
UrlTextBox.Visibility = Visibility.Visible;
ZoomMenuItem.Visibility = Visibility.Visible;
BackwardButton.IsEnabled = WindowSettings.AllowBackwardNavigation;
BackwardButton.Visibility = WindowSettings.AllowBackwardNavigation ? Visibility.Visible : Visibility.Collapsed;
DeveloperConsoleMenuItem.Visibility = WindowSettings.AllowDeveloperConsole ? Visibility.Visible : Visibility.Collapsed;
FindMenuItem.Visibility = settings.AllowFind ? Visibility.Visible : Visibility.Collapsed;
ForwardButton.IsEnabled = WindowSettings.AllowForwardNavigation;
ForwardButton.Visibility = WindowSettings.AllowForwardNavigation ? Visibility.Visible : Visibility.Collapsed;
HomeButton.IsEnabled = WindowSettings.ShowHomeButton;
HomeButton.Visibility = WindowSettings.ShowHomeButton ? Visibility.Visible : Visibility.Collapsed;
ReloadButton.IsEnabled = WindowSettings.AllowReloading;
ReloadButton.Visibility = WindowSettings.ShowReloadButton ? Visibility.Visible : Visibility.Collapsed;
Toolbar.Visibility = WindowSettings.ShowToolbar ? Visibility.Visible : Visibility.Collapsed;
UrlTextBox.Visibility = WindowSettings.AllowAddressBar ? Visibility.Visible : Visibility.Hidden;
ZoomMenuItem.Visibility = settings.AllowPageZoom ? Visibility.Visible : Visibility.Collapsed;
}
private void InitializeBounds()
{
if (isMainWindow && WindowSettings.FullScreenMode)
{
/*
Top = 0;
Left = 0;
Height = SystemParameters.WorkArea.Height;
Width = SystemParameters.WorkArea.Width;
ResizeMode = ResizeMode.NoResize;
WindowStyle = WindowStyle.None;
*/
WindowState = WindowState.Maximized;
}
else if (WindowSettings.RelativeHeight == 100 && WindowSettings.RelativeWidth == 100)
{

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
* Copyright (c) 2025 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

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
* Copyright (c) 2025 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

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
* Copyright (c) 2025 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

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
* Copyright (c) 2025 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

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
* Copyright (c) 2025 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

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
* Copyright (c) 2025 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

View File

@@ -5,7 +5,7 @@
xmlns:fa="http://schemas.fontawesome.io/icons/"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:SafeExamBrowser.UserInterface.Desktop.Windows"
mc:Ignorable="d" Height="250" Width="650" ResizeMode="NoResize" Topmost="True" WindowStartupLocation="CenterScreen">
mc:Ignorable="d" Height="275" Width="650" ResizeMode="NoResize" Topmost="True" WindowStartupLocation="CenterScreen">
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
* Copyright (c) 2025 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
@@ -19,6 +19,9 @@ namespace SafeExamBrowser.UserInterface.Desktop.Windows
{
private readonly IText text;
private bool cancellationRequested;
private bool initialized;
public ProctoringFinalizationDialog(IText text)
{
this.text = text;
@@ -53,14 +56,14 @@ namespace SafeExamBrowser.UserInterface.Desktop.Windows
private void InitializeDialog()
{
Button.Click += (o, args) => Close();
Button.Content = text.Get(TextKey.ProctoringFinalizationDialog_Confirm);
Loaded += (o, args) => this.DisableCloseButton();
Title = text.Get(TextKey.ProctoringFinalizationDialog_Title);
}
private void ShowFailure(RemainingWorkUpdatedEventArgs status)
{
Button.Click += (o, args) => Close();
Button.Content = text.Get(TextKey.ProctoringFinalizationDialog_Confirm);
ButtonPanel.Visibility = Visibility.Visible;
// TODO: Revert once cache handling has been specified and changed!
@@ -77,41 +80,68 @@ namespace SafeExamBrowser.UserInterface.Desktop.Windows
private void ShowProgress(RemainingWorkUpdatedEventArgs status)
{
ButtonPanel.Visibility = Visibility.Collapsed;
ButtonPanel.Visibility = status.AllowCancellation ? Visibility.Visible : Visibility.Collapsed;
Cursor = Cursors.Wait;
FailurePanel.Visibility = Visibility.Collapsed;
Info.Text = text.Get(TextKey.ProctoringFinalizationDialog_InfoMessage);
ProgressPanel.Visibility = Visibility.Visible;
if (status.AllowCancellation && !initialized)
{
Button.Click += (o, args) => cancellationRequested = true;
Button.Content = text.Get(TextKey.ProctoringFinalizationDialog_Abort);
initialized = true;
}
if (status.IsWaiting)
{
var count = $"{status.Total - status.Progress}";
var time = $"{status.Resume.ToLongTimeString()}";
Percentage.Text = "";
Progress.IsIndeterminate = true;
Status.Text = text.Get(TextKey.ProctoringFinalizationDialog_StatusWaiting).Replace("%%_COUNT_%%", count).Replace("%%_TIME_%%", time);
UpdateWaitingProgress(status);
}
else
{
var count = $"{status.Progress}";
var total = $"{status.Total}";
UpdateProgress(status);
}
Percentage.Text = $"{status.Progress / (double) (status.Total > 0 ? status.Total : 1) * 100:N0}%";
Progress.IsIndeterminate = false;
Progress.Maximum = status.Total;
Progress.Value = status.Progress;
status.CancellationRequested = cancellationRequested;
}
if (status.Next.HasValue)
{
Status.Text = text.Get(TextKey.ProctoringFinalizationDialog_StatusAndTime).Replace("%%_TIME_%%", $"{status.Next.Value.ToLongTimeString()}");
}
else
{
Status.Text = text.Get(TextKey.ProctoringFinalizationDialog_Status);
}
private void UpdateProgress(RemainingWorkUpdatedEventArgs status)
{
var count = $"{status.Progress}";
var total = $"{status.Total}";
Status.Text = Status.Text.Replace("%%_COUNT_%%", count).Replace("%%_TOTAL_%%", total);
Percentage.Text = $"{status.Progress / (double) (status.Total > 0 ? status.Total : 1) * 100:N0}%";
Progress.IsIndeterminate = false;
Progress.Maximum = status.Total;
Progress.Value = status.Progress;
if (status.Next.HasValue)
{
Status.Text = text.Get(TextKey.ProctoringFinalizationDialog_StatusAndTime).Replace("%%_TIME_%%", $"{status.Next.Value.ToLongTimeString()}");
}
else
{
Status.Text = text.Get(TextKey.ProctoringFinalizationDialog_Status);
}
Status.Text = Status.Text.Replace("%%_COUNT_%%", count).Replace("%%_TOTAL_%%", total);
}
private void UpdateWaitingProgress(RemainingWorkUpdatedEventArgs status)
{
var count = $"{status.Total - status.Progress}";
var time = status.Resume?.ToLongTimeString();
Percentage.Text = "";
Progress.IsIndeterminate = true;
if (status.Resume.HasValue)
{
Status.Text = text.Get(TextKey.ProctoringFinalizationDialog_StatusWaitingAndTime).Replace("%%_COUNT_%%", count).Replace("%%_TIME_%%", time);
}
else
{
Status.Text = text.Get(TextKey.ProctoringFinalizationDialog_StatusWaiting).Replace("%%_COUNT_%%", count);
}
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
* Copyright (c) 2025 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

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
* Copyright (c) 2025 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

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
* Copyright (c) 2025 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

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
* Copyright (c) 2025 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

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
* Copyright (c) 2025 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
@@ -42,6 +42,7 @@ namespace SafeExamBrowser.UserInterface.Desktop.Windows
internal Taskbar(ILogger logger)
{
this.logger = logger;
InitializeComponent();
InitializeTaskbar();
}
@@ -140,11 +141,9 @@ namespace SafeExamBrowser.UserInterface.Desktop.Windows
private void InitializeTaskbar()
{
/*
Closing += Taskbar_Closing;
Loaded += (o, args) => InitializeBounds();
QuitButton.Clicked += QuitButton_Clicked;
*/
}
public void InitializeText(IText text)

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
* Copyright (c) 2025 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
@@ -80,13 +80,11 @@ namespace SafeExamBrowser.UserInterface.Desktop.Windows
private void InitializeTaskview()
{
/*
Loaded += (o, args) =>
{
Handle = new WindowInteropHelper(this).Handle;
Update();
};
*/
}
private void SelectNext()