diff --git a/SafeExamBrowser.Contracts/I18n/TextKey.cs b/SafeExamBrowser.Contracts/I18n/TextKey.cs
index 7bbb25cf..93fbfb11 100644
--- a/SafeExamBrowser.Contracts/I18n/TextKey.cs
+++ b/SafeExamBrowser.Contracts/I18n/TextKey.cs
@@ -25,6 +25,7 @@ namespace SafeExamBrowser.Contracts.I18n
MessageBox_StartupErrorTitle,
Notification_AboutTooltip,
Notification_LogTooltip,
+ RuntimeWindow_ApplicationRunning,
SplashScreen_CloseServiceConnection,
SplashScreen_EmptyClipboard,
SplashScreen_InitializeBrowser,
diff --git a/SafeExamBrowser.Contracts/SafeExamBrowser.Contracts.csproj b/SafeExamBrowser.Contracts/SafeExamBrowser.Contracts.csproj
index 0542128f..f0e3a0e0 100644
--- a/SafeExamBrowser.Contracts/SafeExamBrowser.Contracts.csproj
+++ b/SafeExamBrowser.Contracts/SafeExamBrowser.Contracts.csproj
@@ -108,6 +108,7 @@
+
diff --git a/SafeExamBrowser.Contracts/UserInterface/IRuntimeWindow.cs b/SafeExamBrowser.Contracts/UserInterface/IRuntimeWindow.cs
new file mode 100644
index 00000000..bfb6ee9b
--- /dev/null
+++ b/SafeExamBrowser.Contracts/UserInterface/IRuntimeWindow.cs
@@ -0,0 +1,21 @@
+/*
+ * Copyright (c) 2018 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 SafeExamBrowser.Contracts.I18n;
+
+namespace SafeExamBrowser.Contracts.UserInterface
+{
+ public interface IRuntimeWindow : IWindow
+ {
+ ///
+ /// Updates the status text of the runtime window. If the busy flag is set,
+ /// the window will show an animation to indicate a long-running operation.
+ ///
+ void UpdateStatus(TextKey key);
+ }
+}
diff --git a/SafeExamBrowser.Core/I18n/Text.xml b/SafeExamBrowser.Core/I18n/Text.xml
index 29c41c97..323e7e30 100644
--- a/SafeExamBrowser.Core/I18n/Text.xml
+++ b/SafeExamBrowser.Core/I18n/Text.xml
@@ -30,6 +30,9 @@
Application Log
+
+ The application is running.
+
Closing service connection
diff --git a/SafeExamBrowser.Runtime.UnitTests/Behaviour/Operations/KioskModeOperationTests.cs b/SafeExamBrowser.Runtime.UnitTests/Behaviour/Operations/KioskModeOperationTests.cs
new file mode 100644
index 00000000..e32291a9
--- /dev/null
+++ b/SafeExamBrowser.Runtime.UnitTests/Behaviour/Operations/KioskModeOperationTests.cs
@@ -0,0 +1,22 @@
+/*
+ * Copyright (c) 2018 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 Microsoft.VisualStudio.TestTools.UnitTesting;
+
+namespace SafeExamBrowser.Runtime.UnitTests.Behaviour.Operations
+{
+ [TestClass]
+ public class KioskModeOperationTests
+ {
+ [TestMethod]
+ public void Todo()
+ {
+ Assert.Fail();
+ }
+ }
+}
diff --git a/SafeExamBrowser.Runtime.UnitTests/SafeExamBrowser.Runtime.UnitTests.csproj b/SafeExamBrowser.Runtime.UnitTests/SafeExamBrowser.Runtime.UnitTests.csproj
index 2b314531..c2150a67 100644
--- a/SafeExamBrowser.Runtime.UnitTests/SafeExamBrowser.Runtime.UnitTests.csproj
+++ b/SafeExamBrowser.Runtime.UnitTests/SafeExamBrowser.Runtime.UnitTests.csproj
@@ -81,6 +81,7 @@
+
diff --git a/SafeExamBrowser.Runtime/Behaviour/Operations/KioskModeOperation.cs b/SafeExamBrowser.Runtime/Behaviour/Operations/KioskModeOperation.cs
new file mode 100644
index 00000000..9e0c917b
--- /dev/null
+++ b/SafeExamBrowser.Runtime/Behaviour/Operations/KioskModeOperation.cs
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2018 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;
+using SafeExamBrowser.Contracts.Behaviour;
+using SafeExamBrowser.Contracts.UserInterface;
+
+namespace SafeExamBrowser.Runtime.Behaviour.Operations
+{
+ internal class KioskModeOperation : IOperation
+ {
+ public bool AbortStartup { get; private set; }
+ public ISplashScreen SplashScreen { private get; set; }
+
+ public void Perform()
+ {
+ // TODO
+ }
+
+ public void Revert()
+ {
+ // TODO
+ }
+ }
+}
diff --git a/SafeExamBrowser.Runtime/Behaviour/RuntimeController.cs b/SafeExamBrowser.Runtime/Behaviour/RuntimeController.cs
index 565dcb55..ba7841af 100644
--- a/SafeExamBrowser.Runtime/Behaviour/RuntimeController.cs
+++ b/SafeExamBrowser.Runtime/Behaviour/RuntimeController.cs
@@ -11,7 +11,9 @@ using System.Linq;
using SafeExamBrowser.Contracts.Behaviour;
using SafeExamBrowser.Contracts.Communication;
using SafeExamBrowser.Contracts.Configuration.Settings;
+using SafeExamBrowser.Contracts.I18n;
using SafeExamBrowser.Contracts.Logging;
+using SafeExamBrowser.Contracts.UserInterface;
namespace SafeExamBrowser.Runtime.Behaviour
{
@@ -20,6 +22,7 @@ namespace SafeExamBrowser.Runtime.Behaviour
private ICommunication serviceProxy;
private Queue operations;
private ILogger logger;
+ private IRuntimeWindow runtimeWindow;
private ISettingsRepository settingsRepository;
private IShutdownController shutdownController;
private IStartupController startupController;
@@ -29,12 +32,14 @@ namespace SafeExamBrowser.Runtime.Behaviour
public RuntimeController(
ICommunication serviceProxy,
ILogger logger,
+ IRuntimeWindow runtimeWindow,
ISettingsRepository settingsRepository,
IShutdownController shutdownController,
IStartupController startupController)
{
this.serviceProxy = serviceProxy;
this.logger = logger;
+ this.runtimeWindow = runtimeWindow;
this.settingsRepository = settingsRepository;
this.shutdownController = shutdownController;
this.startupController = startupController;
@@ -66,6 +71,8 @@ namespace SafeExamBrowser.Runtime.Behaviour
{
logger.Info("Starting event handling...");
// TODO SplashScreen.UpdateText(TextKey.SplashScreen_StartEventHandling);
+
+ runtimeWindow.UpdateStatus(TextKey.RuntimeWindow_ApplicationRunning);
}
private void Stop()
diff --git a/SafeExamBrowser.Runtime/CompositionRoot.cs b/SafeExamBrowser.Runtime/CompositionRoot.cs
index 43389524..56e9285d 100644
--- a/SafeExamBrowser.Runtime/CompositionRoot.cs
+++ b/SafeExamBrowser.Runtime/CompositionRoot.cs
@@ -56,8 +56,8 @@ namespace SafeExamBrowser.Runtime
var shutdownController = new ShutdownController(logger, runtimeInfo, text, uiFactory);
var startupController = new StartupController(logger, runtimeInfo, systemInfo, text, uiFactory);
- RuntimeController = new RuntimeController(serviceProxy, new ModuleLogger(logger, typeof(RuntimeController)), settingsRepository, shutdownController, startupController);
- RuntimeWindow = new RuntimeWindow(new DefaultLogFormatter(), runtimeInfo);
+ RuntimeWindow = new RuntimeWindow(new DefaultLogFormatter(), runtimeInfo, text);
+ RuntimeController = new RuntimeController(serviceProxy, new ModuleLogger(logger, typeof(RuntimeController)), RuntimeWindow, settingsRepository, shutdownController, startupController);
logger.Subscribe(RuntimeWindow);
@@ -65,7 +65,7 @@ namespace SafeExamBrowser.Runtime
StartupOperations.Enqueue(new I18nOperation(logger, text));
StartupOperations.Enqueue(new ConfigurationOperation(logger, runtimeInfo, settingsRepository, text, uiFactory, args));
StartupOperations.Enqueue(new ServiceOperation(logger, serviceProxy, settingsRepository, text));
- //StartupOperations.Enqueue(new KioskModeOperation());
+ StartupOperations.Enqueue(new KioskModeOperation());
}
internal void LogStartupInformation()
diff --git a/SafeExamBrowser.Runtime/SafeExamBrowser.Runtime.csproj b/SafeExamBrowser.Runtime/SafeExamBrowser.Runtime.csproj
index 8a5d9433..2657b348 100644
--- a/SafeExamBrowser.Runtime/SafeExamBrowser.Runtime.csproj
+++ b/SafeExamBrowser.Runtime/SafeExamBrowser.Runtime.csproj
@@ -88,6 +88,7 @@
+
diff --git a/SafeExamBrowser.UserInterface.Classic/RuntimeWindow.xaml b/SafeExamBrowser.UserInterface.Classic/RuntimeWindow.xaml
index f5d1bed9..1964c83a 100644
--- a/SafeExamBrowser.UserInterface.Classic/RuntimeWindow.xaml
+++ b/SafeExamBrowser.UserInterface.Classic/RuntimeWindow.xaml
@@ -6,7 +6,7 @@
xmlns:local="clr-namespace:SafeExamBrowser.UserInterface.Classic"
xmlns:s="clr-namespace:System;assembly=mscorlib"
mc:Ignorable="d" Background="White" Foreground="White" Height="500" Width="750" WindowStyle="None" WindowStartupLocation="CenterScreen"
- Icon="./Images/SafeExamBrowser.ico" ResizeMode="NoResize" Title="RuntimeWindow" Topmost="True">
+ Icon="./Images/SafeExamBrowser.ico" ResizeMode="NoResize" Title="Safe Exam Browser" Topmost="True">
@@ -26,31 +26,33 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 5
+ 5
+
+
+
+
-
-
-
-
-
- 5
- 5
-
-
-
-
-
+
diff --git a/SafeExamBrowser.UserInterface.Classic/RuntimeWindow.xaml.cs b/SafeExamBrowser.UserInterface.Classic/RuntimeWindow.xaml.cs
index 21f7a232..948211e9 100644
--- a/SafeExamBrowser.UserInterface.Classic/RuntimeWindow.xaml.cs
+++ b/SafeExamBrowser.UserInterface.Classic/RuntimeWindow.xaml.cs
@@ -10,32 +10,57 @@ using System;
using System.Windows;
using System.Windows.Documents;
using SafeExamBrowser.Contracts.Configuration;
+using SafeExamBrowser.Contracts.I18n;
using SafeExamBrowser.Contracts.Logging;
+using SafeExamBrowser.Contracts.UserInterface;
namespace SafeExamBrowser.UserInterface.Classic
{
- public partial class RuntimeWindow : Window, ILogObserver
+ public partial class RuntimeWindow : Window, ILogObserver, IRuntimeWindow
{
private ILogContentFormatter formatter;
private IRuntimeInfo runtimeInfo;
+ private IText text;
+ private WindowClosingEventHandler closing;
- public RuntimeWindow(ILogContentFormatter formatter, IRuntimeInfo runtimeInfo)
+ event WindowClosingEventHandler IWindow.Closing
+ {
+ add { closing += value; }
+ remove { closing -= value; }
+ }
+
+ public RuntimeWindow(ILogContentFormatter formatter, IRuntimeInfo runtimeInfo, IText text)
{
this.formatter = formatter;
this.runtimeInfo = runtimeInfo;
+ this.text = text;
InitializeComponent();
InitializeRuntimeWindow();
}
+ public void BringToForeground()
+ {
+ Dispatcher.Invoke(Activate);
+ }
+
public void Notify(ILogContent content)
{
- LogTextBlock.Text += formatter.Format(content) + Environment.NewLine;
- LogScrollViewer.ScrollToEnd();
+ Dispatcher.Invoke(() =>
+ {
+ LogTextBlock.Text += formatter.Format(content) + Environment.NewLine;
+ LogScrollViewer.ScrollToEnd();
+ });
+ }
+
+ public void UpdateStatus(TextKey key)
+ {
+ Dispatcher.Invoke(() => StatusTextBlock.Text = text.Get(key));
}
private void InitializeRuntimeWindow()
{
+ Title = $"{runtimeInfo.ProgramTitle} - Version {runtimeInfo.ProgramVersion}";
InfoTextBlock.Inlines.Add(new Run($"Version {runtimeInfo.ProgramVersion}") { FontStyle = FontStyles.Italic });
InfoTextBlock.Inlines.Add(new LineBreak());
InfoTextBlock.Inlines.Add(new LineBreak());