diff --git a/SafeExamBrowser.Browser/BrowserIconResource.cs b/SafeExamBrowser.Browser/BrowserIconResource.cs index c1d97705..f34ad241 100644 --- a/SafeExamBrowser.Browser/BrowserIconResource.cs +++ b/SafeExamBrowser.Browser/BrowserIconResource.cs @@ -13,7 +13,8 @@ namespace SafeExamBrowser.Browser { public class BrowserIconResource : IApplicationIconResource { - public Uri Uri => new Uri("pack://application:,,,/SafeExamBrowser.Browser;component/Images/ChromiumLogo.png"); - public bool IsUriResource => true; + public Uri Uri => new Uri("pack://application:,,,/SafeExamBrowser.Browser;component/Images/ChromiumLogo.xaml"); + public bool IsBitmapResource => false; + public bool IsXamlResource => true; } } diff --git a/SafeExamBrowser.Browser/Images/ChromiumLogo.png b/SafeExamBrowser.Browser/Images/ChromiumLogo.png deleted file mode 100644 index 0ebfdbe3..00000000 Binary files a/SafeExamBrowser.Browser/Images/ChromiumLogo.png and /dev/null differ diff --git a/SafeExamBrowser.Browser/Images/ChromiumLogo.xaml b/SafeExamBrowser.Browser/Images/ChromiumLogo.xaml new file mode 100644 index 00000000..04c5340d --- /dev/null +++ b/SafeExamBrowser.Browser/Images/ChromiumLogo.xaml @@ -0,0 +1,197 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SafeExamBrowser.Browser/Images/ChromiumLogo_Attribution.txt b/SafeExamBrowser.Browser/Images/ChromiumLogo_Attribution.txt index b20cc5dd..f09ff5f4 100644 --- a/SafeExamBrowser.Browser/Images/ChromiumLogo_Attribution.txt +++ b/SafeExamBrowser.Browser/Images/ChromiumLogo_Attribution.txt @@ -1,2 +1,2 @@ -The "Chromium 11 Logo" by The Chromium Development Documentation Project / The Chromium Authors is licensed under -Creative Commons attribution 2.5. Source: https://commons.wikimedia.org/wiki/File:Chromium_11_Logo.svg \ No newline at end of file +The "Chromium 11 Logo" by The Chromium Development Documentation Project / The Chromium Authors is licensed under Creative +Commons attribution 2.5. Taken from https://commons.wikimedia.org/wiki/File:Chromium_11_Logo.svg and converted to XAML. \ No newline at end of file diff --git a/SafeExamBrowser.Browser/SafeExamBrowser.Browser.csproj b/SafeExamBrowser.Browser/SafeExamBrowser.Browser.csproj index c9969365..3d605b75 100644 --- a/SafeExamBrowser.Browser/SafeExamBrowser.Browser.csproj +++ b/SafeExamBrowser.Browser/SafeExamBrowser.Browser.csproj @@ -50,10 +50,14 @@ SafeExamBrowser.Contracts - + + + MSBuild:Compile + Designer + + - \ No newline at end of file diff --git a/SafeExamBrowser.Contracts/Configuration/IApplicationIconResource.cs b/SafeExamBrowser.Contracts/Configuration/IApplicationIconResource.cs index dde1084b..d5a26c82 100644 --- a/SafeExamBrowser.Contracts/Configuration/IApplicationIconResource.cs +++ b/SafeExamBrowser.Contracts/Configuration/IApplicationIconResource.cs @@ -18,8 +18,13 @@ namespace SafeExamBrowser.Contracts.Configuration Uri Uri { get; } /// - /// Indicates whether the icon resource consists of a Uri. + /// Indicates whether the icon resource consists of a bitmap image (i.e. raster graphics). /// - bool IsUriResource { get; } + bool IsBitmapResource { get; } + + /// + /// Indicates whether the icon resource consists of XAML markup (i.e. vector graphics). + /// + bool IsXamlResource { get; } } } diff --git a/SafeExamBrowser.UserInterface/Controls/DateTimeControl.xaml b/SafeExamBrowser.UserInterface/Controls/DateTimeControl.xaml index 2f67c7c3..11983e9c 100644 --- a/SafeExamBrowser.UserInterface/Controls/DateTimeControl.xaml +++ b/SafeExamBrowser.UserInterface/Controls/DateTimeControl.xaml @@ -5,7 +5,7 @@ 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"> - + diff --git a/SafeExamBrowser.UserInterface/Controls/DateTimeControl.xaml.cs b/SafeExamBrowser.UserInterface/Controls/DateTimeControl.xaml.cs index c1d56276..767b9df7 100644 --- a/SafeExamBrowser.UserInterface/Controls/DateTimeControl.xaml.cs +++ b/SafeExamBrowser.UserInterface/Controls/DateTimeControl.xaml.cs @@ -19,6 +19,7 @@ namespace SafeExamBrowser.UserInterface.Controls { InitializeComponent(); + DataContext = model; TimeTextBlock.DataContext = model; DateTextBlock.DataContext = model; } diff --git a/SafeExamBrowser.UserInterface/Controls/TaskbarButton.xaml b/SafeExamBrowser.UserInterface/Controls/TaskbarButton.xaml index 99526f0e..b6ee6bc7 100644 --- a/SafeExamBrowser.UserInterface/Controls/TaskbarButton.xaml +++ b/SafeExamBrowser.UserInterface/Controls/TaskbarButton.xaml @@ -5,10 +5,24 @@ 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"> + d:DesignHeight="40" d:DesignWidth="50"> - diff --git a/SafeExamBrowser.UserInterface/Controls/TaskbarButton.xaml.cs b/SafeExamBrowser.UserInterface/Controls/TaskbarButton.xaml.cs index cc03e4d6..7abb258a 100644 --- a/SafeExamBrowser.UserInterface/Controls/TaskbarButton.xaml.cs +++ b/SafeExamBrowser.UserInterface/Controls/TaskbarButton.xaml.cs @@ -7,7 +7,9 @@ */ using System; +using System.Windows; using System.Windows.Controls; +using System.Windows.Markup; using System.Windows.Media.Imaging; using SafeExamBrowser.Contracts.Configuration; using SafeExamBrowser.Contracts.UserInterface; @@ -38,19 +40,28 @@ namespace SafeExamBrowser.UserInterface.Controls { Button.ToolTip = info.Tooltip; - if (info.IconResource.IsUriResource) + if (info.IconResource.IsBitmapResource) { var icon = new BitmapImage(); + var iconImage = new Image(); icon.BeginInit(); icon.UriSource = info.IconResource.Uri; icon.EndInit(); - IconImage.Source = icon; + iconImage.Source = icon; + Button.Content = iconImage; + } + else if (info.IconResource.IsXamlResource) + { + using (var stream = Application.GetResourceStream(info.IconResource.Uri)?.Stream) + { + Button.Content = XamlReader.Load(stream); + } } } - private void Button_Click(object sender, System.Windows.RoutedEventArgs e) + private void Button_Click(object sender, RoutedEventArgs e) { // TODO OnClick?.Invoke(); diff --git a/SafeExamBrowser.UserInterface/Images/Icon.ico b/SafeExamBrowser.UserInterface/Images/Icon.ico new file mode 100644 index 00000000..abdc4635 Binary files /dev/null and b/SafeExamBrowser.UserInterface/Images/Icon.ico differ diff --git a/SafeExamBrowser.UserInterface/SafeExamBrowser.UserInterface.csproj b/SafeExamBrowser.UserInterface/SafeExamBrowser.UserInterface.csproj index 43f02d4d..fceef047 100644 --- a/SafeExamBrowser.UserInterface/SafeExamBrowser.UserInterface.csproj +++ b/SafeExamBrowser.UserInterface/SafeExamBrowser.UserInterface.csproj @@ -112,5 +112,8 @@ + + + \ No newline at end of file diff --git a/SafeExamBrowser.UserInterface/SplashScreen.xaml b/SafeExamBrowser.UserInterface/SplashScreen.xaml index f8727931..27c2dbb4 100644 --- a/SafeExamBrowser.UserInterface/SplashScreen.xaml +++ b/SafeExamBrowser.UserInterface/SplashScreen.xaml @@ -4,7 +4,7 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" - Title="SplashScreen" Height="200" Width="350" WindowStyle="None" AllowsTransparency="True" WindowStartupLocation="CenterScreen" Cursor="Wait"> + Title="SplashScreen" Height="200" Width="350" WindowStyle="None" AllowsTransparency="True" WindowStartupLocation="CenterScreen" Cursor="Wait" Icon="./Images/Icon.ico"> diff --git a/SafeExamBrowser.UserInterface/Taskbar.xaml b/SafeExamBrowser.UserInterface/Taskbar.xaml index e2854204..afd87abe 100644 --- a/SafeExamBrowser.UserInterface/Taskbar.xaml +++ b/SafeExamBrowser.UserInterface/Taskbar.xaml @@ -5,7 +5,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:SafeExamBrowser.UserInterface.Controls" 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" Icon="./Images/Icon.ico"> diff --git a/SafeExamBrowser.UserInterface/ViewModels/DateTimeViewModel.cs b/SafeExamBrowser.UserInterface/ViewModels/DateTimeViewModel.cs index ec01318b..afa22efc 100644 --- a/SafeExamBrowser.UserInterface/ViewModels/DateTimeViewModel.cs +++ b/SafeExamBrowser.UserInterface/ViewModels/DateTimeViewModel.cs @@ -25,16 +25,21 @@ namespace SafeExamBrowser.UserInterface.ViewModels timer.Start(); } - public string Time { get; private set; } public string Date { get; private set; } + public string Time { get; private set; } + public string ToolTip { get; private set; } private void Timer_Elapsed(object sender, ElapsedEventArgs e) { - Time = DateTime.Now.ToShortTimeString(); - Date = DateTime.Now.ToShortDateString(); + var date = DateTime.Now; + + Date = date.ToShortDateString(); + Time = date.ToShortTimeString(); + ToolTip = $"{date.ToLongDateString()} {date.ToLongTimeString()}"; PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(Time))); PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(Date))); + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(ToolTip))); } } } diff --git a/SafeExamBrowser/Icon.ico b/SafeExamBrowser/Icon.ico new file mode 100644 index 00000000..abdc4635 Binary files /dev/null and b/SafeExamBrowser/Icon.ico differ diff --git a/SafeExamBrowser/SafeExamBrowser.csproj b/SafeExamBrowser/SafeExamBrowser.csproj index 03506c44..75e35ec9 100644 --- a/SafeExamBrowser/SafeExamBrowser.csproj +++ b/SafeExamBrowser/SafeExamBrowser.csproj @@ -13,6 +13,7 @@ {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 4 true + false publish\ true Disk @@ -25,7 +26,6 @@ true 0 3.0.0.%2a - false false true @@ -48,6 +48,12 @@ prompt 4 + + SafeExamBrowser.App + + + Icon.ico + @@ -122,5 +128,8 @@ false + + + \ No newline at end of file