SEBWIN-450: Added proctoring window for mobile UI.
This commit is contained in:
parent
0e120998b8
commit
4286291877
4 changed files with 141 additions and 2 deletions
|
@ -172,6 +172,9 @@
|
||||||
<Compile Include="Properties\AssemblyInfo.cs">
|
<Compile Include="Properties\AssemblyInfo.cs">
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="Windows\ProctoringWindow.xaml.cs">
|
||||||
|
<DependentUpon>ProctoringWindow.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="Windows\RuntimeWindow.xaml.cs">
|
<Compile Include="Windows\RuntimeWindow.xaml.cs">
|
||||||
<DependentUpon>RuntimeWindow.xaml</DependentUpon>
|
<DependentUpon>RuntimeWindow.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
@ -480,6 +483,10 @@
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</Page>
|
</Page>
|
||||||
|
<Page Include="Windows\ProctoringWindow.xaml">
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
<Page Include="Windows\RuntimeWindow.xaml">
|
<Page Include="Windows\RuntimeWindow.xaml">
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
|
|
|
@ -165,8 +165,7 @@ namespace SafeExamBrowser.UserInterface.Mobile
|
||||||
|
|
||||||
public IProctoringWindow CreateProctoringWindow(IProctoringControl control)
|
public IProctoringWindow CreateProctoringWindow(IProctoringControl control)
|
||||||
{
|
{
|
||||||
// TODO
|
return Application.Current.Dispatcher.Invoke(() => new ProctoringWindow(control));
|
||||||
throw new System.NotImplementedException();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public IRuntimeWindow CreateRuntimeWindow(AppConfig appConfig)
|
public IRuntimeWindow CreateRuntimeWindow(AppConfig appConfig)
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
<Window x:Class="SafeExamBrowser.UserInterface.Mobile.Windows.ProctoringWindow"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:local="clr-namespace:SafeExamBrowser.UserInterface.Mobile.Windows"
|
||||||
|
mc:Ignorable="d" Height="250" Width="350" MinHeight="250" MinWidth="250" Topmost="True" WindowStyle="ToolWindow">
|
||||||
|
</Window>
|
|
@ -0,0 +1,125 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2021 ETH Zürich, Educational Development and Technology (LET)
|
||||||
|
*
|
||||||
|
* 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;
|
||||||
|
using System.Windows;
|
||||||
|
using SafeExamBrowser.UserInterface.Contracts.Proctoring;
|
||||||
|
using SafeExamBrowser.UserInterface.Contracts.Windows;
|
||||||
|
using SafeExamBrowser.UserInterface.Contracts.Windows.Events;
|
||||||
|
using SafeExamBrowser.UserInterface.Shared.Utilities;
|
||||||
|
|
||||||
|
namespace SafeExamBrowser.UserInterface.Mobile.Windows
|
||||||
|
{
|
||||||
|
public partial class ProctoringWindow : Window, IProctoringWindow
|
||||||
|
{
|
||||||
|
private WindowClosingEventHandler closing;
|
||||||
|
|
||||||
|
event WindowClosingEventHandler IWindow.Closing
|
||||||
|
{
|
||||||
|
add { closing += value; }
|
||||||
|
remove { closing -= value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProctoringWindow(IProctoringControl control)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
InitializeWindow(control);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void BringToForeground()
|
||||||
|
{
|
||||||
|
Dispatcher.Invoke(() =>
|
||||||
|
{
|
||||||
|
if (WindowState == WindowState.Minimized)
|
||||||
|
{
|
||||||
|
WindowState = WindowState.Normal;
|
||||||
|
}
|
||||||
|
|
||||||
|
Activate();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public new void Close()
|
||||||
|
{
|
||||||
|
Dispatcher.Invoke(() =>
|
||||||
|
{
|
||||||
|
Closing -= ProctoringWindow_Closing;
|
||||||
|
closing?.Invoke();
|
||||||
|
base.Close();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public new void Hide()
|
||||||
|
{
|
||||||
|
Dispatcher.Invoke(base.Hide);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetTitle(string title)
|
||||||
|
{
|
||||||
|
Dispatcher.Invoke(() => Title = title ?? "");
|
||||||
|
}
|
||||||
|
|
||||||
|
public new void Show()
|
||||||
|
{
|
||||||
|
Dispatcher.Invoke(base.Show);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Toggle()
|
||||||
|
{
|
||||||
|
Dispatcher.Invoke(() =>
|
||||||
|
{
|
||||||
|
if (Visibility == Visibility.Visible)
|
||||||
|
{
|
||||||
|
base.Hide();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
base.Show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void InitializeWindow(IProctoringControl control)
|
||||||
|
{
|
||||||
|
if (control is UIElement element)
|
||||||
|
{
|
||||||
|
Content = element;
|
||||||
|
control.FullScreenChanged += Control_FullScreenChanged;
|
||||||
|
}
|
||||||
|
|
||||||
|
Closing += ProctoringWindow_Closing;
|
||||||
|
Loaded += ProctoringWindow_Loaded;
|
||||||
|
Top = SystemParameters.WorkArea.Height - Height - 15;
|
||||||
|
Left = SystemParameters.WorkArea.Width - Width - 20;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Control_FullScreenChanged(bool fullScreen)
|
||||||
|
{
|
||||||
|
if (fullScreen)
|
||||||
|
{
|
||||||
|
WindowState = WindowState.Maximized;
|
||||||
|
WindowStyle = WindowStyle.None;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
WindowState = WindowState.Normal;
|
||||||
|
WindowStyle = WindowStyle.ToolWindow;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ProctoringWindow_Closing(object sender, CancelEventArgs e)
|
||||||
|
{
|
||||||
|
e.Cancel = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ProctoringWindow_Loaded(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
this.HideCloseButton();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue