diff --git a/SafeExamBrowser.UserInterface.Classic/Properties/AssemblyInfo.cs b/SafeExamBrowser.UserInterface.Classic/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..55c3583c --- /dev/null +++ b/SafeExamBrowser.UserInterface.Classic/Properties/AssemblyInfo.cs @@ -0,0 +1,55 @@ +using System.Reflection; +using System.Resources; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Windows; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("SafeExamBrowser.UserInterface.Classic")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("SafeExamBrowser.UserInterface.Classic")] +[assembly: AssemblyCopyright("Copyright © 2017")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +//In order to begin building localizable applications, set +//CultureYouAreCodingWith in your .csproj file +//inside a . For example, if you are using US english +//in your source files, set the to en-US. Then uncomment +//the NeutralResourceLanguage attribute below. Update the "en-US" in +//the line below to match the UICulture setting in the project file. + +//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] + + +[assembly:ThemeInfo( + ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located + //(used if a resource is not found in the page, + // or application resource dictionaries) + ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located + //(used if a resource is not found in the page, + // app, or any theme specific resource dictionaries) +)] + + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/SafeExamBrowser.UserInterface.Classic/Properties/Resources.Designer.cs b/SafeExamBrowser.UserInterface.Classic/Properties/Resources.Designer.cs new file mode 100644 index 00000000..39f07f9e --- /dev/null +++ b/SafeExamBrowser.UserInterface.Classic/Properties/Resources.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace SafeExamBrowser.UserInterface.Classic.Properties { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SafeExamBrowser.UserInterface.Classic.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/SafeExamBrowser.UserInterface/Properties/Resources.resx b/SafeExamBrowser.UserInterface.Classic/Properties/Resources.resx similarity index 100% rename from SafeExamBrowser.UserInterface/Properties/Resources.resx rename to SafeExamBrowser.UserInterface.Classic/Properties/Resources.resx diff --git a/SafeExamBrowser.UserInterface.Classic/Properties/Settings.Designer.cs b/SafeExamBrowser.UserInterface.Classic/Properties/Settings.Designer.cs new file mode 100644 index 00000000..20075d16 --- /dev/null +++ b/SafeExamBrowser.UserInterface.Classic/Properties/Settings.Designer.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace SafeExamBrowser.UserInterface.Classic.Properties { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.3.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default { + get { + return defaultInstance; + } + } + } +} diff --git a/SafeExamBrowser.UserInterface/Properties/Settings.settings b/SafeExamBrowser.UserInterface.Classic/Properties/Settings.settings similarity index 100% rename from SafeExamBrowser.UserInterface/Properties/Settings.settings rename to SafeExamBrowser.UserInterface.Classic/Properties/Settings.settings diff --git a/SafeExamBrowser.UserInterface.Classic/SafeExamBrowser.UserInterface.Classic.csproj b/SafeExamBrowser.UserInterface.Classic/SafeExamBrowser.UserInterface.Classic.csproj new file mode 100644 index 00000000..d4714cbd --- /dev/null +++ b/SafeExamBrowser.UserInterface.Classic/SafeExamBrowser.UserInterface.Classic.csproj @@ -0,0 +1,103 @@ + + + + + Debug + AnyCPU + {A502DF54-7169-4647-94BD-18B192924866} + library + SafeExamBrowser.UserInterface.Classic + SafeExamBrowser.UserInterface.Classic + v4.5.2 + 512 + {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 4 + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + true + bin\x86\Debug\ + DEBUG;TRACE + full + x86 + prompt + MinimumRecommendedRules.ruleset + + + bin\x86\Release\ + TRACE + true + pdbonly + x86 + prompt + MinimumRecommendedRules.ruleset + + + + + + 4.0 + + + + + + + + + MSBuild:Compile + Designer + + + Taskbar.xaml + Code + + + + + Code + + + True + True + Resources.resx + + + True + Settings.settings + True + + + ResXFileCodeGenerator + Resources.Designer.cs + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + + + {47DA5933-BEF8-4729-94E6-ABDE2DB12262} + SafeExamBrowser.Contracts + + + + \ No newline at end of file diff --git a/SafeExamBrowser.UserInterface.Classic/Taskbar.xaml b/SafeExamBrowser.UserInterface.Classic/Taskbar.xaml new file mode 100644 index 00000000..fe0f092f --- /dev/null +++ b/SafeExamBrowser.UserInterface.Classic/Taskbar.xaml @@ -0,0 +1,12 @@ + + + + + diff --git a/SafeExamBrowser.UserInterface.Classic/Taskbar.xaml.cs b/SafeExamBrowser.UserInterface.Classic/Taskbar.xaml.cs new file mode 100644 index 00000000..edb99269 --- /dev/null +++ b/SafeExamBrowser.UserInterface.Classic/Taskbar.xaml.cs @@ -0,0 +1,93 @@ +/* + * 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; +using SafeExamBrowser.Contracts.Logging; +using SafeExamBrowser.Contracts.UserInterface.Taskbar; + +namespace SafeExamBrowser.UserInterface.Classic +{ + public partial class Taskbar : Window, ITaskbar + { + private ILogger logger; + + public Taskbar(ILogger logger) + { + InitializeComponent(); + + this.logger = logger; + + Loaded += (o, args) => InitializeBounds(); + Closing += Taskbar_Closing; + } + + public void AddApplication(IApplicationButton button) + { + if (button is UIElement) + { + // TODO: ApplicationStackPanel.Children.Add(button as UIElement); + } + } + + public void AddNotification(INotificationButton button) + { + if (button is UIElement) + { + // TODO: NotificationStackPanel.Children.Add(button as UIElement); + } + } + + public void AddSystemControl(ISystemControl control) + { + if (control is UIElement) + { + // TODO: SystemControlStackPanel.Children.Add(control as UIElement); + } + } + + public int GetAbsoluteHeight() + { + return Dispatcher.Invoke(() => + { + //var height = (int) this.TransformToPhysical(Width, Height).Y; + + //logger.Info($"Calculated physical taskbar height is {height}px."); + + //return height; + + return 40; + }); + } + + public void InitializeBounds() + { + Dispatcher.Invoke(() => + { + //Width = SystemParameters.WorkArea.Right; + //Left = SystemParameters.WorkArea.Right - Width; + //Top = SystemParameters.WorkArea.Bottom; + + //var position = this.TransformToPhysical(Left, Top); + //var size = this.TransformToPhysical(Width, Height); + + //logger.Info($"Set taskbar bounds to {Width}x{Height} at ({Left}/{Top}), in physical pixels: {size.X}x{size.Y} at ({position.X}/{position.Y})."); + }); + } + + private void Taskbar_Closing(object sender, System.ComponentModel.CancelEventArgs e) + { + //foreach (var child in SystemControlStackPanel.Children) + //{ + // if (child is ISystemControl) + // { + // (child as ISystemControl).Close(); + // } + //} + } + } +} diff --git a/SafeExamBrowser.UserInterface.Classic/UserInterfaceFactory.cs b/SafeExamBrowser.UserInterface.Classic/UserInterfaceFactory.cs new file mode 100644 index 00000000..edb34380 --- /dev/null +++ b/SafeExamBrowser.UserInterface.Classic/UserInterfaceFactory.cs @@ -0,0 +1,61 @@ +/* + * 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 SafeExamBrowser.Contracts.Configuration; +using SafeExamBrowser.Contracts.Configuration.Settings; +using SafeExamBrowser.Contracts.I18n; +using SafeExamBrowser.Contracts.Logging; +using SafeExamBrowser.Contracts.UserInterface; +using SafeExamBrowser.Contracts.UserInterface.Taskbar; + +namespace SafeExamBrowser.UserInterface.Classic +{ + public class UserInterfaceFactory : IUserInterfaceFactory + { + public IWindow CreateAboutWindow(ISettings settings, IText text) + { + throw new NotImplementedException(); + } + + public IApplicationButton CreateApplicationButton(IApplicationInfo info) + { + throw new NotImplementedException(); + } + + public IBrowserWindow CreateBrowserWindow(IBrowserControl control, IBrowserSettings settings) + { + throw new NotImplementedException(); + } + + public IWindow CreateLogWindow(ILogger logger, IText text) + { + throw new NotImplementedException(); + } + + public INotificationButton CreateNotification(INotificationInfo info) + { + throw new NotImplementedException(); + } + + public ISystemPowerSupplyControl CreatePowerSupplyControl() + { + throw new NotImplementedException(); + } + + public ISplashScreen CreateSplashScreen(ISettings settings, IText text) + { + throw new NotImplementedException(); + } + + public void Show(string message, string title, MessageBoxAction action = MessageBoxAction.Confirm, MessageBoxIcon icon = MessageBoxIcon.Information) + { + throw new NotImplementedException(); + } + } +} diff --git a/SafeExamBrowser.UserInterface/Utilities/VisualExtensions.cs b/SafeExamBrowser.UserInterface.Classic/Utilities/VisualExtensions.cs similarity index 100% rename from SafeExamBrowser.UserInterface/Utilities/VisualExtensions.cs rename to SafeExamBrowser.UserInterface.Classic/Utilities/VisualExtensions.cs diff --git a/SafeExamBrowser.UserInterface/AboutWindow.xaml b/SafeExamBrowser.UserInterface.Windows10/AboutWindow.xaml similarity index 100% rename from SafeExamBrowser.UserInterface/AboutWindow.xaml rename to SafeExamBrowser.UserInterface.Windows10/AboutWindow.xaml diff --git a/SafeExamBrowser.UserInterface/AboutWindow.xaml.cs b/SafeExamBrowser.UserInterface.Windows10/AboutWindow.xaml.cs similarity index 100% rename from SafeExamBrowser.UserInterface/AboutWindow.xaml.cs rename to SafeExamBrowser.UserInterface.Windows10/AboutWindow.xaml.cs diff --git a/SafeExamBrowser.UserInterface/BrowserWindow.xaml b/SafeExamBrowser.UserInterface.Windows10/BrowserWindow.xaml similarity index 100% rename from SafeExamBrowser.UserInterface/BrowserWindow.xaml rename to SafeExamBrowser.UserInterface.Windows10/BrowserWindow.xaml diff --git a/SafeExamBrowser.UserInterface/BrowserWindow.xaml.cs b/SafeExamBrowser.UserInterface.Windows10/BrowserWindow.xaml.cs similarity index 100% rename from SafeExamBrowser.UserInterface/BrowserWindow.xaml.cs rename to SafeExamBrowser.UserInterface.Windows10/BrowserWindow.xaml.cs diff --git a/SafeExamBrowser.UserInterface/Controls/ApplicationButton.xaml b/SafeExamBrowser.UserInterface.Windows10/Controls/ApplicationButton.xaml similarity index 100% rename from SafeExamBrowser.UserInterface/Controls/ApplicationButton.xaml rename to SafeExamBrowser.UserInterface.Windows10/Controls/ApplicationButton.xaml diff --git a/SafeExamBrowser.UserInterface/Controls/ApplicationButton.xaml.cs b/SafeExamBrowser.UserInterface.Windows10/Controls/ApplicationButton.xaml.cs similarity index 100% rename from SafeExamBrowser.UserInterface/Controls/ApplicationButton.xaml.cs rename to SafeExamBrowser.UserInterface.Windows10/Controls/ApplicationButton.xaml.cs diff --git a/SafeExamBrowser.UserInterface/Controls/ApplicationInstanceButton.xaml b/SafeExamBrowser.UserInterface.Windows10/Controls/ApplicationInstanceButton.xaml similarity index 100% rename from SafeExamBrowser.UserInterface/Controls/ApplicationInstanceButton.xaml rename to SafeExamBrowser.UserInterface.Windows10/Controls/ApplicationInstanceButton.xaml diff --git a/SafeExamBrowser.UserInterface/Controls/ApplicationInstanceButton.xaml.cs b/SafeExamBrowser.UserInterface.Windows10/Controls/ApplicationInstanceButton.xaml.cs similarity index 100% rename from SafeExamBrowser.UserInterface/Controls/ApplicationInstanceButton.xaml.cs rename to SafeExamBrowser.UserInterface.Windows10/Controls/ApplicationInstanceButton.xaml.cs diff --git a/SafeExamBrowser.UserInterface/Controls/DateTimeControl.xaml b/SafeExamBrowser.UserInterface.Windows10/Controls/DateTimeControl.xaml similarity index 100% rename from SafeExamBrowser.UserInterface/Controls/DateTimeControl.xaml rename to SafeExamBrowser.UserInterface.Windows10/Controls/DateTimeControl.xaml diff --git a/SafeExamBrowser.UserInterface/Controls/DateTimeControl.xaml.cs b/SafeExamBrowser.UserInterface.Windows10/Controls/DateTimeControl.xaml.cs similarity index 100% rename from SafeExamBrowser.UserInterface/Controls/DateTimeControl.xaml.cs rename to SafeExamBrowser.UserInterface.Windows10/Controls/DateTimeControl.xaml.cs diff --git a/SafeExamBrowser.UserInterface/Controls/NotificationButton.xaml b/SafeExamBrowser.UserInterface.Windows10/Controls/NotificationButton.xaml similarity index 100% rename from SafeExamBrowser.UserInterface/Controls/NotificationButton.xaml rename to SafeExamBrowser.UserInterface.Windows10/Controls/NotificationButton.xaml diff --git a/SafeExamBrowser.UserInterface/Controls/NotificationButton.xaml.cs b/SafeExamBrowser.UserInterface.Windows10/Controls/NotificationButton.xaml.cs similarity index 100% rename from SafeExamBrowser.UserInterface/Controls/NotificationButton.xaml.cs rename to SafeExamBrowser.UserInterface.Windows10/Controls/NotificationButton.xaml.cs diff --git a/SafeExamBrowser.UserInterface/Controls/PowerSupplyControl.xaml b/SafeExamBrowser.UserInterface.Windows10/Controls/PowerSupplyControl.xaml similarity index 100% rename from SafeExamBrowser.UserInterface/Controls/PowerSupplyControl.xaml rename to SafeExamBrowser.UserInterface.Windows10/Controls/PowerSupplyControl.xaml diff --git a/SafeExamBrowser.UserInterface/Controls/PowerSupplyControl.xaml.cs b/SafeExamBrowser.UserInterface.Windows10/Controls/PowerSupplyControl.xaml.cs similarity index 100% rename from SafeExamBrowser.UserInterface/Controls/PowerSupplyControl.xaml.cs rename to SafeExamBrowser.UserInterface.Windows10/Controls/PowerSupplyControl.xaml.cs diff --git a/SafeExamBrowser.UserInterface/Controls/QuitButton.xaml b/SafeExamBrowser.UserInterface.Windows10/Controls/QuitButton.xaml similarity index 100% rename from SafeExamBrowser.UserInterface/Controls/QuitButton.xaml rename to SafeExamBrowser.UserInterface.Windows10/Controls/QuitButton.xaml diff --git a/SafeExamBrowser.UserInterface/Controls/QuitButton.xaml.cs b/SafeExamBrowser.UserInterface.Windows10/Controls/QuitButton.xaml.cs similarity index 100% rename from SafeExamBrowser.UserInterface/Controls/QuitButton.xaml.cs rename to SafeExamBrowser.UserInterface.Windows10/Controls/QuitButton.xaml.cs diff --git a/SafeExamBrowser.UserInterface/Images/Chromium.ico b/SafeExamBrowser.UserInterface.Windows10/Images/Chromium.ico similarity index 100% rename from SafeExamBrowser.UserInterface/Images/Chromium.ico rename to SafeExamBrowser.UserInterface.Windows10/Images/Chromium.ico diff --git a/SafeExamBrowser.UserInterface/Images/LogNotification.ico b/SafeExamBrowser.UserInterface.Windows10/Images/LogNotification.ico similarity index 100% rename from SafeExamBrowser.UserInterface/Images/LogNotification.ico rename to SafeExamBrowser.UserInterface.Windows10/Images/LogNotification.ico diff --git a/SafeExamBrowser.UserInterface/Images/SafeExamBrowser.ico b/SafeExamBrowser.UserInterface.Windows10/Images/SafeExamBrowser.ico similarity index 100% rename from SafeExamBrowser.UserInterface/Images/SafeExamBrowser.ico rename to SafeExamBrowser.UserInterface.Windows10/Images/SafeExamBrowser.ico diff --git a/SafeExamBrowser.UserInterface/Images/SplashScreen.png b/SafeExamBrowser.UserInterface.Windows10/Images/SplashScreen.png similarity index 100% rename from SafeExamBrowser.UserInterface/Images/SplashScreen.png rename to SafeExamBrowser.UserInterface.Windows10/Images/SplashScreen.png diff --git a/SafeExamBrowser.UserInterface/LogWindow.xaml b/SafeExamBrowser.UserInterface.Windows10/LogWindow.xaml similarity index 100% rename from SafeExamBrowser.UserInterface/LogWindow.xaml rename to SafeExamBrowser.UserInterface.Windows10/LogWindow.xaml diff --git a/SafeExamBrowser.UserInterface/LogWindow.xaml.cs b/SafeExamBrowser.UserInterface.Windows10/LogWindow.xaml.cs similarity index 100% rename from SafeExamBrowser.UserInterface/LogWindow.xaml.cs rename to SafeExamBrowser.UserInterface.Windows10/LogWindow.xaml.cs diff --git a/SafeExamBrowser.UserInterface/Properties/AssemblyInfo.cs b/SafeExamBrowser.UserInterface.Windows10/Properties/AssemblyInfo.cs similarity index 100% rename from SafeExamBrowser.UserInterface/Properties/AssemblyInfo.cs rename to SafeExamBrowser.UserInterface.Windows10/Properties/AssemblyInfo.cs diff --git a/SafeExamBrowser.UserInterface/Properties/Resources.Designer.cs b/SafeExamBrowser.UserInterface.Windows10/Properties/Resources.Designer.cs similarity index 100% rename from SafeExamBrowser.UserInterface/Properties/Resources.Designer.cs rename to SafeExamBrowser.UserInterface.Windows10/Properties/Resources.Designer.cs diff --git a/SafeExamBrowser.UserInterface.Windows10/Properties/Resources.resx b/SafeExamBrowser.UserInterface.Windows10/Properties/Resources.resx new file mode 100644 index 00000000..af7dbebb --- /dev/null +++ b/SafeExamBrowser.UserInterface.Windows10/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/SafeExamBrowser.UserInterface/Properties/Settings.Designer.cs b/SafeExamBrowser.UserInterface.Windows10/Properties/Settings.Designer.cs similarity index 100% rename from SafeExamBrowser.UserInterface/Properties/Settings.Designer.cs rename to SafeExamBrowser.UserInterface.Windows10/Properties/Settings.Designer.cs diff --git a/SafeExamBrowser.UserInterface.Windows10/Properties/Settings.settings b/SafeExamBrowser.UserInterface.Windows10/Properties/Settings.settings new file mode 100644 index 00000000..033d7a5e --- /dev/null +++ b/SafeExamBrowser.UserInterface.Windows10/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/SafeExamBrowser.UserInterface/SafeExamBrowser.UserInterface.Windows10.csproj b/SafeExamBrowser.UserInterface.Windows10/SafeExamBrowser.UserInterface.Windows10.csproj similarity index 100% rename from SafeExamBrowser.UserInterface/SafeExamBrowser.UserInterface.Windows10.csproj rename to SafeExamBrowser.UserInterface.Windows10/SafeExamBrowser.UserInterface.Windows10.csproj diff --git a/SafeExamBrowser.UserInterface/SplashScreen.xaml b/SafeExamBrowser.UserInterface.Windows10/SplashScreen.xaml similarity index 100% rename from SafeExamBrowser.UserInterface/SplashScreen.xaml rename to SafeExamBrowser.UserInterface.Windows10/SplashScreen.xaml diff --git a/SafeExamBrowser.UserInterface/SplashScreen.xaml.cs b/SafeExamBrowser.UserInterface.Windows10/SplashScreen.xaml.cs similarity index 100% rename from SafeExamBrowser.UserInterface/SplashScreen.xaml.cs rename to SafeExamBrowser.UserInterface.Windows10/SplashScreen.xaml.cs diff --git a/SafeExamBrowser.UserInterface/Taskbar.xaml b/SafeExamBrowser.UserInterface.Windows10/Taskbar.xaml similarity index 100% rename from SafeExamBrowser.UserInterface/Taskbar.xaml rename to SafeExamBrowser.UserInterface.Windows10/Taskbar.xaml diff --git a/SafeExamBrowser.UserInterface/Taskbar.xaml.cs b/SafeExamBrowser.UserInterface.Windows10/Taskbar.xaml.cs similarity index 100% rename from SafeExamBrowser.UserInterface/Taskbar.xaml.cs rename to SafeExamBrowser.UserInterface.Windows10/Taskbar.xaml.cs diff --git a/SafeExamBrowser.UserInterface/Templates/Buttons.xaml b/SafeExamBrowser.UserInterface.Windows10/Templates/Buttons.xaml similarity index 100% rename from SafeExamBrowser.UserInterface/Templates/Buttons.xaml rename to SafeExamBrowser.UserInterface.Windows10/Templates/Buttons.xaml diff --git a/SafeExamBrowser.UserInterface/UserInterfaceFactory.cs b/SafeExamBrowser.UserInterface.Windows10/UserInterfaceFactory.cs similarity index 100% rename from SafeExamBrowser.UserInterface/UserInterfaceFactory.cs rename to SafeExamBrowser.UserInterface.Windows10/UserInterfaceFactory.cs diff --git a/SafeExamBrowser.UserInterface/Utilities/IconResourceLoader.cs b/SafeExamBrowser.UserInterface.Windows10/Utilities/IconResourceLoader.cs similarity index 100% rename from SafeExamBrowser.UserInterface/Utilities/IconResourceLoader.cs rename to SafeExamBrowser.UserInterface.Windows10/Utilities/IconResourceLoader.cs diff --git a/SafeExamBrowser.UserInterface.Windows10/Utilities/VisualExtensions.cs b/SafeExamBrowser.UserInterface.Windows10/Utilities/VisualExtensions.cs new file mode 100644 index 00000000..3b1d9089 --- /dev/null +++ b/SafeExamBrowser.UserInterface.Windows10/Utilities/VisualExtensions.cs @@ -0,0 +1,42 @@ +/* + * 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; +using System.Windows.Interop; +using System.Windows.Media; + +namespace SafeExamBrowser.UserInterface.Windows10.Utilities +{ + internal static class VisualExtensions + { + /// + /// WPF works with device-independent pixels. This method is required to + /// transform such values to their absolute, device-specific pixel value. + /// Source: https://stackoverflow.com/questions/3286175/how-do-i-convert-a-wpf-size-to-physical-pixels + /// + internal static Vector TransformToPhysical(this Visual visual, double x, double y) + { + Matrix transformToDevice; + var source = PresentationSource.FromVisual(visual); + + if (source != null) + { + transformToDevice = source.CompositionTarget.TransformToDevice; + } + else + { + using (var newSource = new HwndSource(new HwndSourceParameters())) + { + transformToDevice = newSource.CompositionTarget.TransformToDevice; + } + } + + return transformToDevice.Transform(new Vector(x, y)); + } + } +} diff --git a/SafeExamBrowser.UserInterface/ViewModels/DateTimeViewModel.cs b/SafeExamBrowser.UserInterface.Windows10/ViewModels/DateTimeViewModel.cs similarity index 100% rename from SafeExamBrowser.UserInterface/ViewModels/DateTimeViewModel.cs rename to SafeExamBrowser.UserInterface.Windows10/ViewModels/DateTimeViewModel.cs diff --git a/SafeExamBrowser.UserInterface/ViewModels/LogViewModel.cs b/SafeExamBrowser.UserInterface.Windows10/ViewModels/LogViewModel.cs similarity index 100% rename from SafeExamBrowser.UserInterface/ViewModels/LogViewModel.cs rename to SafeExamBrowser.UserInterface.Windows10/ViewModels/LogViewModel.cs diff --git a/SafeExamBrowser.UserInterface/ViewModels/SplashScreenViewModel.cs b/SafeExamBrowser.UserInterface.Windows10/ViewModels/SplashScreenViewModel.cs similarity index 100% rename from SafeExamBrowser.UserInterface/ViewModels/SplashScreenViewModel.cs rename to SafeExamBrowser.UserInterface.Windows10/ViewModels/SplashScreenViewModel.cs diff --git a/SafeExamBrowser.sln b/SafeExamBrowser.sln index de6fcc40..a6117992 100644 --- a/SafeExamBrowser.sln +++ b/SafeExamBrowser.sln @@ -13,7 +13,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution README.md = README.md EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SafeExamBrowser.UserInterface.Windows10", "SafeExamBrowser.UserInterface\SafeExamBrowser.UserInterface.Windows10.csproj", "{E1BE031A-4354-41E7-83E8-843DED4489FF}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SafeExamBrowser.UserInterface.Windows10", "SafeExamBrowser.UserInterface.Windows10\SafeExamBrowser.UserInterface.Windows10.csproj", "{E1BE031A-4354-41E7-83E8-843DED4489FF}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SafeExamBrowser.Core.UnitTests", "SafeExamBrowser.Core.UnitTests\SafeExamBrowser.Core.UnitTests.csproj", "{48B9F2A1-B87D-40F0-BEC9-399E8909860F}" EndProject @@ -29,6 +29,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SafeExamBrowser.WindowsApi" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SafeExamBrowser.SystemComponents", "SafeExamBrowser.SystemComponents\SafeExamBrowser.SystemComponents.csproj", "{ACEE2EF1-14D2-4B52-8994-5C053055BB51}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SafeExamBrowser.UserInterface.Classic", "SafeExamBrowser.UserInterface.Classic\SafeExamBrowser.UserInterface.Classic.csproj", "{A502DF54-7169-4647-94BD-18B192924866}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -117,6 +119,14 @@ Global {ACEE2EF1-14D2-4B52-8994-5C053055BB51}.Release|Any CPU.Build.0 = Release|Any CPU {ACEE2EF1-14D2-4B52-8994-5C053055BB51}.Release|x86.ActiveCfg = Release|Any CPU {ACEE2EF1-14D2-4B52-8994-5C053055BB51}.Release|x86.Build.0 = Release|Any CPU + {A502DF54-7169-4647-94BD-18B192924866}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A502DF54-7169-4647-94BD-18B192924866}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A502DF54-7169-4647-94BD-18B192924866}.Debug|x86.ActiveCfg = Debug|x86 + {A502DF54-7169-4647-94BD-18B192924866}.Debug|x86.Build.0 = Debug|x86 + {A502DF54-7169-4647-94BD-18B192924866}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A502DF54-7169-4647-94BD-18B192924866}.Release|Any CPU.Build.0 = Release|Any CPU + {A502DF54-7169-4647-94BD-18B192924866}.Release|x86.ActiveCfg = Release|Any CPU + {A502DF54-7169-4647-94BD-18B192924866}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/SafeExamBrowser/CompositionRoot.cs b/SafeExamBrowser/CompositionRoot.cs index 5ccb6311..598266d7 100644 --- a/SafeExamBrowser/CompositionRoot.cs +++ b/SafeExamBrowser/CompositionRoot.cs @@ -29,7 +29,7 @@ using SafeExamBrowser.Monitoring.Mouse; using SafeExamBrowser.Monitoring.Processes; using SafeExamBrowser.Monitoring.Windows; using SafeExamBrowser.SystemComponents; -using SafeExamBrowser.UserInterface.Windows10; +using SafeExamBrowser.UserInterface.Classic; using SafeExamBrowser.WindowsApi; namespace SafeExamBrowser diff --git a/SafeExamBrowser/SafeExamBrowser.csproj b/SafeExamBrowser/SafeExamBrowser.csproj index f32e964e..c96125c8 100644 --- a/SafeExamBrowser/SafeExamBrowser.csproj +++ b/SafeExamBrowser/SafeExamBrowser.csproj @@ -139,9 +139,9 @@ {ACEE2EF1-14D2-4B52-8994-5C053055BB51} SafeExamBrowser.SystemComponents - - {e1be031a-4354-41e7-83e8-843ded4489ff} - SafeExamBrowser.UserInterface.Windows10 + + {a502df54-7169-4647-94bd-18b192924866} + SafeExamBrowser.UserInterface.Classic {73724659-4150-4792-A94E-42F5F3C1B696}