diff --git a/SafeExamBrowser.Contracts/SafeExamBrowser.Contracts.csproj b/SafeExamBrowser.Contracts/SafeExamBrowser.Contracts.csproj
index e45dd046..01114287 100644
--- a/SafeExamBrowser.Contracts/SafeExamBrowser.Contracts.csproj
+++ b/SafeExamBrowser.Contracts/SafeExamBrowser.Contracts.csproj
@@ -57,6 +57,7 @@
+
diff --git a/SafeExamBrowser.Contracts/UserInterface/ITaskbar.cs b/SafeExamBrowser.Contracts/UserInterface/ITaskbar.cs
index abbaf869..d14f864f 100644
--- a/SafeExamBrowser.Contracts/UserInterface/ITaskbar.cs
+++ b/SafeExamBrowser.Contracts/UserInterface/ITaskbar.cs
@@ -10,6 +10,7 @@ namespace SafeExamBrowser.Contracts.UserInterface
{
public interface ITaskbar
{
+ void AddButton(ITaskbarButton button);
void SetPosition(int x, int y);
void SetSize(int widht, int height);
void Show();
diff --git a/SafeExamBrowser.Contracts/UserInterface/ITaskbarButton.cs b/SafeExamBrowser.Contracts/UserInterface/ITaskbarButton.cs
new file mode 100644
index 00000000..f61bc4d1
--- /dev/null
+++ b/SafeExamBrowser.Contracts/UserInterface/ITaskbarButton.cs
@@ -0,0 +1,17 @@
+/*
+ * Copyright (c) 2017 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/.
+ */
+
+namespace SafeExamBrowser.Contracts.UserInterface
+{
+ public delegate void TaskbarButtonClickHandler();
+
+ public interface ITaskbarButton
+ {
+ event TaskbarButtonClickHandler OnClick;
+ }
+}
diff --git a/SafeExamBrowser.Core/Configuration/StartupController.cs b/SafeExamBrowser.Core/Configuration/StartupController.cs
index 3faf63b9..c86325f3 100644
--- a/SafeExamBrowser.Core/Configuration/StartupController.cs
+++ b/SafeExamBrowser.Core/Configuration/StartupController.cs
@@ -56,22 +56,22 @@ namespace SafeExamBrowser.Core.Configuration
// - Logging of all running processes
// - Setting of wallpaper
// - Initialization of taskbar
- // - Killing explorer.exer
+ // - Killing explorer.exe
// - Minimizing all open windows
// - Emptying clipboard
// - Activation of process monitoring
- Thread.Sleep(3000);
+ Thread.Sleep(1000);
splashScreen.UpdateProgress();
logger.Info("Baapa-dee boopa-dee!");
- Thread.Sleep(3000);
+ Thread.Sleep(1000);
splashScreen.UpdateProgress();
logger.Info("Closing splash screen.");
- Thread.Sleep(3000);
+ Thread.Sleep(1000);
splashScreen.UpdateProgress();
logger.Unsubscribe(splashScreen);
diff --git a/SafeExamBrowser.UserInterface/Controls/DateTimeControl.xaml b/SafeExamBrowser.UserInterface/Controls/DateTimeControl.xaml
new file mode 100644
index 00000000..2f67c7c3
--- /dev/null
+++ b/SafeExamBrowser.UserInterface/Controls/DateTimeControl.xaml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/SafeExamBrowser.UserInterface/Controls/DateTimeControl.xaml.cs b/SafeExamBrowser.UserInterface/Controls/DateTimeControl.xaml.cs
new file mode 100644
index 00000000..c1d56276
--- /dev/null
+++ b/SafeExamBrowser.UserInterface/Controls/DateTimeControl.xaml.cs
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2017 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.Windows.Controls;
+using SafeExamBrowser.UserInterface.ViewModels;
+
+namespace SafeExamBrowser.UserInterface.Controls
+{
+ public partial class DateTimeControl : UserControl
+ {
+ private DateTimeViewModel model = new DateTimeViewModel();
+
+ public DateTimeControl()
+ {
+ InitializeComponent();
+
+ TimeTextBlock.DataContext = model;
+ DateTextBlock.DataContext = model;
+ }
+ }
+}
diff --git a/SafeExamBrowser.UserInterface/Controls/TaskbarButton.xaml b/SafeExamBrowser.UserInterface/Controls/TaskbarButton.xaml
new file mode 100644
index 00000000..cb1caf2a
--- /dev/null
+++ b/SafeExamBrowser.UserInterface/Controls/TaskbarButton.xaml
@@ -0,0 +1,14 @@
+
+
+
+
+
diff --git a/SafeExamBrowser.UserInterface/Controls/TaskbarButton.xaml.cs b/SafeExamBrowser.UserInterface/Controls/TaskbarButton.xaml.cs
new file mode 100644
index 00000000..78e33223
--- /dev/null
+++ b/SafeExamBrowser.UserInterface/Controls/TaskbarButton.xaml.cs
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2017 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 System.Windows.Controls;
+using System.Windows.Media.Imaging;
+using SafeExamBrowser.Contracts.UserInterface;
+
+namespace SafeExamBrowser.UserInterface.Controls
+{
+ public partial class TaskbarButton : UserControl, ITaskbarButton
+ {
+ public event TaskbarButtonClickHandler OnClick;
+
+ public TaskbarButton(string imageUri)
+ {
+ InitializeComponent();
+
+ var icon = new BitmapImage();
+
+ icon.BeginInit();
+ icon.UriSource = new Uri(imageUri);
+ icon.EndInit();
+
+ IconImage.Source = icon;
+ }
+ }
+}
diff --git a/SafeExamBrowser.UserInterface/SafeExamBrowser.UserInterface.csproj b/SafeExamBrowser.UserInterface/SafeExamBrowser.UserInterface.csproj
index f5f9645c..693734cf 100644
--- a/SafeExamBrowser.UserInterface/SafeExamBrowser.UserInterface.csproj
+++ b/SafeExamBrowser.UserInterface/SafeExamBrowser.UserInterface.csproj
@@ -47,6 +47,12 @@
+
+ DateTimeControl.xaml
+
+
+ TaskbarButton.xaml
+
Code
@@ -66,6 +72,7 @@
Taskbar.xaml
+
@@ -78,6 +85,14 @@
+
+ Designer
+ MSBuild:Compile
+
+
+ Designer
+ MSBuild:Compile
+
Designer
MSBuild:Compile
diff --git a/SafeExamBrowser.UserInterface/Taskbar.xaml b/SafeExamBrowser.UserInterface/Taskbar.xaml
index 46fa7371..e2854204 100644
--- a/SafeExamBrowser.UserInterface/Taskbar.xaml
+++ b/SafeExamBrowser.UserInterface/Taskbar.xaml
@@ -3,7 +3,7 @@
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"
+ xmlns:local="clr-namespace:SafeExamBrowser.UserInterface.Controls"
mc:Ignorable="d"
Title="Taskbar" Height="40" Width="750" WindowStyle="None" AllowsTransparency="True" Topmost="True">
@@ -16,5 +16,7 @@
+
+
diff --git a/SafeExamBrowser.UserInterface/Taskbar.xaml.cs b/SafeExamBrowser.UserInterface/Taskbar.xaml.cs
index 4ed67410..129b08ac 100644
--- a/SafeExamBrowser.UserInterface/Taskbar.xaml.cs
+++ b/SafeExamBrowser.UserInterface/Taskbar.xaml.cs
@@ -18,6 +18,14 @@ namespace SafeExamBrowser.UserInterface
InitializeComponent();
}
+ public void AddButton(ITaskbarButton button)
+ {
+ if (button is UIElement)
+ {
+ ApplicationAreaStackPanel.Children.Add(button as UIElement);
+ }
+ }
+
public void SetPosition(int x, int y)
{
Left = x;
diff --git a/SafeExamBrowser.UserInterface/ViewModels/DateTimeViewModel.cs b/SafeExamBrowser.UserInterface/ViewModels/DateTimeViewModel.cs
new file mode 100644
index 00000000..ec01318b
--- /dev/null
+++ b/SafeExamBrowser.UserInterface/ViewModels/DateTimeViewModel.cs
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2017 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 System.ComponentModel;
+using System.Timers;
+
+namespace SafeExamBrowser.UserInterface.ViewModels
+{
+ class DateTimeViewModel : INotifyPropertyChanged
+ {
+ private Timer timer;
+
+ public event PropertyChangedEventHandler PropertyChanged;
+
+ public DateTimeViewModel()
+ {
+ timer = new Timer(1000);
+ timer.Elapsed += Timer_Elapsed;
+ timer.Start();
+ }
+
+ public string Time { get; private set; }
+ public string Date { get; private set; }
+
+ private void Timer_Elapsed(object sender, ElapsedEventArgs e)
+ {
+ Time = DateTime.Now.ToShortTimeString();
+ Date = DateTime.Now.ToShortDateString();
+
+ PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(Time)));
+ PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(Date)));
+ }
+ }
+}
diff --git a/SafeExamBrowser/App.cs b/SafeExamBrowser/App.cs
index 4eb077df..876c200f 100644
--- a/SafeExamBrowser/App.cs
+++ b/SafeExamBrowser/App.cs
@@ -85,7 +85,7 @@ namespace SafeExamBrowser
});
}
- //instances.SplashScreen.Dispatcher.Invoke(instances.SplashScreen.Close);
+ instances.SplashScreen.Dispatcher.Invoke(instances.SplashScreen.Close);
}
}
}