Started implementing taskbar.
This commit is contained in:
parent
7bc2686560
commit
16ba40e9a7
13 changed files with 179 additions and 6 deletions
|
@ -57,6 +57,7 @@
|
||||||
<Compile Include="UserInterface\ITaskbar.cs" />
|
<Compile Include="UserInterface\ITaskbar.cs" />
|
||||||
<Compile Include="I18n\ITextResource.cs" />
|
<Compile Include="I18n\ITextResource.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
<Compile Include="UserInterface\ITaskbarButton.cs" />
|
||||||
<Compile Include="UserInterface\MessageBoxAction.cs" />
|
<Compile Include="UserInterface\MessageBoxAction.cs" />
|
||||||
<Compile Include="UserInterface\MessageBoxIcon.cs" />
|
<Compile Include="UserInterface\MessageBoxIcon.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
|
@ -10,6 +10,7 @@ namespace SafeExamBrowser.Contracts.UserInterface
|
||||||
{
|
{
|
||||||
public interface ITaskbar
|
public interface ITaskbar
|
||||||
{
|
{
|
||||||
|
void AddButton(ITaskbarButton button);
|
||||||
void SetPosition(int x, int y);
|
void SetPosition(int x, int y);
|
||||||
void SetSize(int widht, int height);
|
void SetSize(int widht, int height);
|
||||||
void Show();
|
void Show();
|
||||||
|
|
17
SafeExamBrowser.Contracts/UserInterface/ITaskbarButton.cs
Normal file
17
SafeExamBrowser.Contracts/UserInterface/ITaskbarButton.cs
Normal file
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -56,22 +56,22 @@ namespace SafeExamBrowser.Core.Configuration
|
||||||
// - Logging of all running processes
|
// - Logging of all running processes
|
||||||
// - Setting of wallpaper
|
// - Setting of wallpaper
|
||||||
// - Initialization of taskbar
|
// - Initialization of taskbar
|
||||||
// - Killing explorer.exer
|
// - Killing explorer.exe
|
||||||
// - Minimizing all open windows
|
// - Minimizing all open windows
|
||||||
// - Emptying clipboard
|
// - Emptying clipboard
|
||||||
// - Activation of process monitoring
|
// - Activation of process monitoring
|
||||||
|
|
||||||
Thread.Sleep(3000);
|
Thread.Sleep(1000);
|
||||||
|
|
||||||
splashScreen.UpdateProgress();
|
splashScreen.UpdateProgress();
|
||||||
logger.Info("Baapa-dee boopa-dee!");
|
logger.Info("Baapa-dee boopa-dee!");
|
||||||
|
|
||||||
Thread.Sleep(3000);
|
Thread.Sleep(1000);
|
||||||
|
|
||||||
splashScreen.UpdateProgress();
|
splashScreen.UpdateProgress();
|
||||||
logger.Info("Closing splash screen.");
|
logger.Info("Closing splash screen.");
|
||||||
|
|
||||||
Thread.Sleep(3000);
|
Thread.Sleep(1000);
|
||||||
|
|
||||||
splashScreen.UpdateProgress();
|
splashScreen.UpdateProgress();
|
||||||
logger.Unsubscribe(splashScreen);
|
logger.Unsubscribe(splashScreen);
|
||||||
|
|
16
SafeExamBrowser.UserInterface/Controls/DateTimeControl.xaml
Normal file
16
SafeExamBrowser.UserInterface/Controls/DateTimeControl.xaml
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
<UserControl x:Class="SafeExamBrowser.UserInterface.Controls.DateTimeControl"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:local="clr-namespace:SafeExamBrowser.UserInterface.Controls"
|
||||||
|
mc:Ignorable="d" d:DesignHeight="40" d:DesignWidth="75">
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="1*" />
|
||||||
|
<RowDefinition Height="1*" />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<TextBlock x:Name="TimeTextBlock" Grid.Row="0" Text="{Binding Path=Time}" Foreground="White" HorizontalAlignment="Center" VerticalAlignment="Center" />
|
||||||
|
<TextBlock x:Name="DateTextBlock" Grid.Row="1" Text="{Binding Path=Date}" Foreground="White" HorizontalAlignment="Center" VerticalAlignment="Center" />
|
||||||
|
</Grid>
|
||||||
|
</UserControl>
|
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
14
SafeExamBrowser.UserInterface/Controls/TaskbarButton.xaml
Normal file
14
SafeExamBrowser.UserInterface/Controls/TaskbarButton.xaml
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
<UserControl x:Class="SafeExamBrowser.UserInterface.Controls.TaskbarButton"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:local="clr-namespace:SafeExamBrowser.UserInterface.Controls"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
d:DesignHeight="40" d:DesignWidth="40">
|
||||||
|
<Grid>
|
||||||
|
<Button x:Name="Button" Background="#00000000" BorderThickness="0">
|
||||||
|
<Image x:Name="IconImage" />
|
||||||
|
</Button>
|
||||||
|
</Grid>
|
||||||
|
</UserControl>
|
33
SafeExamBrowser.UserInterface/Controls/TaskbarButton.xaml.cs
Normal file
33
SafeExamBrowser.UserInterface/Controls/TaskbarButton.xaml.cs
Normal file
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -47,6 +47,12 @@
|
||||||
<Reference Include="PresentationFramework" />
|
<Reference Include="PresentationFramework" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Compile Include="Controls\DateTimeControl.xaml.cs">
|
||||||
|
<DependentUpon>DateTimeControl.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Controls\TaskbarButton.xaml.cs">
|
||||||
|
<DependentUpon>TaskbarButton.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="Properties\AssemblyInfo.cs">
|
<Compile Include="Properties\AssemblyInfo.cs">
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
@ -66,6 +72,7 @@
|
||||||
<Compile Include="Taskbar.xaml.cs">
|
<Compile Include="Taskbar.xaml.cs">
|
||||||
<DependentUpon>Taskbar.xaml</DependentUpon>
|
<DependentUpon>Taskbar.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="ViewModels\DateTimeViewModel.cs" />
|
||||||
<Compile Include="ViewModels\SplashScreenViewModel.cs" />
|
<Compile Include="ViewModels\SplashScreenViewModel.cs" />
|
||||||
<Compile Include="WpfMessageBox.cs" />
|
<Compile Include="WpfMessageBox.cs" />
|
||||||
<EmbeddedResource Include="Properties\Resources.resx">
|
<EmbeddedResource Include="Properties\Resources.resx">
|
||||||
|
@ -78,6 +85,14 @@
|
||||||
</None>
|
</None>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Page Include="Controls\DateTimeControl.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
|
<Page Include="Controls\TaskbarButton.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
<Page Include="SplashScreen.xaml">
|
<Page Include="SplashScreen.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
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"
|
mc:Ignorable="d"
|
||||||
Title="Taskbar" Height="40" Width="750" WindowStyle="None" AllowsTransparency="True" Topmost="True">
|
Title="Taskbar" Height="40" Width="750" WindowStyle="None" AllowsTransparency="True" Topmost="True">
|
||||||
<Window.Background>
|
<Window.Background>
|
||||||
|
@ -16,5 +16,7 @@
|
||||||
<ColumnDefinition Width="75" />
|
<ColumnDefinition Width="75" />
|
||||||
<ColumnDefinition Width="40" />
|
<ColumnDefinition Width="40" />
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
|
<StackPanel x:Name="ApplicationAreaStackPanel" Orientation="Horizontal" />
|
||||||
|
<local:DateTimeControl Grid.Column="2" />
|
||||||
</Grid>
|
</Grid>
|
||||||
</Window>
|
</Window>
|
||||||
|
|
|
@ -18,6 +18,14 @@ namespace SafeExamBrowser.UserInterface
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void AddButton(ITaskbarButton button)
|
||||||
|
{
|
||||||
|
if (button is UIElement)
|
||||||
|
{
|
||||||
|
ApplicationAreaStackPanel.Children.Add(button as UIElement);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void SetPosition(int x, int y)
|
public void SetPosition(int x, int y)
|
||||||
{
|
{
|
||||||
Left = x;
|
Left = x;
|
||||||
|
|
|
@ -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)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -85,7 +85,7 @@ namespace SafeExamBrowser
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
//instances.SplashScreen.Dispatcher.Invoke(instances.SplashScreen.Close);
|
instances.SplashScreen.Dispatcher.Invoke(instances.SplashScreen.Close);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue