From 57c3afdaa50e107af361a6671d17feda9e40efa5 Mon Sep 17 00:00:00 2001 From: dbuechel Date: Fri, 19 Jan 2018 09:23:09 +0100 Subject: [PATCH] SEBWIN-219: Introduced configuration mode and continued with configuration operation. --- .../Settings/Settings.cs | 20 ++++++----- .../Settings/SettingsRepository.cs | 8 ++--- .../Settings/ConfigurationMode.cs | 16 +++++++++ .../Configuration/Settings/ISettings.cs | 5 +++ SafeExamBrowser.Contracts/I18n/TextKey.cs | 2 ++ .../SafeExamBrowser.Contracts.csproj | 2 ++ .../UserInterface/IMessageBox.cs | 4 +-- .../UserInterface/MessageBoxAction.cs | 3 +- .../UserInterface/MessageBoxIcon.cs | 5 +-- .../UserInterface/MessageBoxResult.cs | 19 +++++++++++ SafeExamBrowser.Core/I18n/Text.xml | 2 ++ .../Operations/ConfigurationOperationTests.cs | 30 ++++++++++------ .../Operations/ConfigurationOperation.cs | 25 ++++++++++++-- SafeExamBrowser.Runtime/CompositionRoot.cs | 2 +- .../UserInterfaceFactory.cs | 34 ++++++++++++++++--- .../UserInterfaceFactory.cs | 34 ++++++++++++++++--- 16 files changed, 168 insertions(+), 43 deletions(-) create mode 100644 SafeExamBrowser.Contracts/Configuration/Settings/ConfigurationMode.cs create mode 100644 SafeExamBrowser.Contracts/UserInterface/MessageBoxResult.cs diff --git a/SafeExamBrowser.Configuration/Settings/Settings.cs b/SafeExamBrowser.Configuration/Settings/Settings.cs index 2e4b5685..34449e5f 100644 --- a/SafeExamBrowser.Configuration/Settings/Settings.cs +++ b/SafeExamBrowser.Configuration/Settings/Settings.cs @@ -14,17 +14,19 @@ namespace SafeExamBrowser.Configuration.Settings [Serializable] internal class Settings : ISettings { - public IBrowserSettings Browser { get; private set; } - public IKeyboardSettings Keyboard { get; private set; } - public IMouseSettings Mouse { get; private set; } - public ITaskbarSettings Taskbar { get; private set; } + public ConfigurationMode ConfigurationMode { get; set; } - public Settings(BrowserSettings browser, KeyboardSettings keyboard, MouseSettings mouse, TaskbarSettings taskbar) + public IBrowserSettings Browser { get; set; } + public IKeyboardSettings Keyboard { get; set; } + public IMouseSettings Mouse { get; set; } + public ITaskbarSettings Taskbar { get; set; } + + public Settings() { - Browser = browser; - Keyboard = keyboard; - Mouse = mouse; - Taskbar = taskbar; + Browser = new BrowserSettings(); + Keyboard = new KeyboardSettings(); + Mouse = new MouseSettings(); + Taskbar = new TaskbarSettings(); } } } diff --git a/SafeExamBrowser.Configuration/Settings/SettingsRepository.cs b/SafeExamBrowser.Configuration/Settings/SettingsRepository.cs index 701757ba..f613eccc 100644 --- a/SafeExamBrowser.Configuration/Settings/SettingsRepository.cs +++ b/SafeExamBrowser.Configuration/Settings/SettingsRepository.cs @@ -16,16 +16,12 @@ namespace SafeExamBrowser.Configuration.Settings public ISettings Load(Uri path) { // TODO - throw new NotImplementedException(); + return LoadDefaults(); } public ISettings LoadDefaults() { - var browser = new BrowserSettings(); - var keyboard = new KeyboardSettings(); - var mouse = new MouseSettings(); - var taskbar = new TaskbarSettings(); - var settings = new Settings(browser, keyboard, mouse, taskbar); + var settings = new Settings(); // TODO diff --git a/SafeExamBrowser.Contracts/Configuration/Settings/ConfigurationMode.cs b/SafeExamBrowser.Contracts/Configuration/Settings/ConfigurationMode.cs new file mode 100644 index 00000000..fb208a1a --- /dev/null +++ b/SafeExamBrowser.Contracts/Configuration/Settings/ConfigurationMode.cs @@ -0,0 +1,16 @@ +/* + * 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/. + */ + +namespace SafeExamBrowser.Contracts.Configuration.Settings +{ + public enum ConfigurationMode + { + ConfigureClient, + Exam + } +} diff --git a/SafeExamBrowser.Contracts/Configuration/Settings/ISettings.cs b/SafeExamBrowser.Contracts/Configuration/Settings/ISettings.cs index 5b2015d9..b27ba7e5 100644 --- a/SafeExamBrowser.Contracts/Configuration/Settings/ISettings.cs +++ b/SafeExamBrowser.Contracts/Configuration/Settings/ISettings.cs @@ -10,6 +10,11 @@ namespace SafeExamBrowser.Contracts.Configuration.Settings { public interface ISettings { + /// + /// The mode which determines the configuration behaviour. + /// + ConfigurationMode ConfigurationMode { get; } + /// /// All browser-related settings. /// diff --git a/SafeExamBrowser.Contracts/I18n/TextKey.cs b/SafeExamBrowser.Contracts/I18n/TextKey.cs index 1666d67e..a44828b5 100644 --- a/SafeExamBrowser.Contracts/I18n/TextKey.cs +++ b/SafeExamBrowser.Contracts/I18n/TextKey.cs @@ -15,6 +15,8 @@ namespace SafeExamBrowser.Contracts.I18n { Browser_ShowDeveloperConsole, LogWindow_Title, + MessageBox_ConfigureClientSuccess, + MessageBox_ConfigureClientSuccessTitle, MessageBox_ShutdownError, MessageBox_ShutdownErrorTitle, MessageBox_SingleInstance, diff --git a/SafeExamBrowser.Contracts/SafeExamBrowser.Contracts.csproj b/SafeExamBrowser.Contracts/SafeExamBrowser.Contracts.csproj index 2d630c3c..bfcd66da 100644 --- a/SafeExamBrowser.Contracts/SafeExamBrowser.Contracts.csproj +++ b/SafeExamBrowser.Contracts/SafeExamBrowser.Contracts.csproj @@ -54,6 +54,7 @@ + @@ -98,6 +99,7 @@ + diff --git a/SafeExamBrowser.Contracts/UserInterface/IMessageBox.cs b/SafeExamBrowser.Contracts/UserInterface/IMessageBox.cs index c11dcd2a..8a6b15ac 100644 --- a/SafeExamBrowser.Contracts/UserInterface/IMessageBox.cs +++ b/SafeExamBrowser.Contracts/UserInterface/IMessageBox.cs @@ -11,8 +11,8 @@ namespace SafeExamBrowser.Contracts.UserInterface public interface IMessageBox { /// - /// Shows a message box according to the specified parameters. + /// Shows a message box according to the specified parameters and returns the result chosen by the user. /// - void Show(string message, string title, MessageBoxAction action = MessageBoxAction.Confirm, MessageBoxIcon icon = MessageBoxIcon.Information); + MessageBoxResult Show(string message, string title, MessageBoxAction action = MessageBoxAction.Confirm, MessageBoxIcon icon = MessageBoxIcon.Information); } } diff --git a/SafeExamBrowser.Contracts/UserInterface/MessageBoxAction.cs b/SafeExamBrowser.Contracts/UserInterface/MessageBoxAction.cs index 3effd351..5290f1f8 100644 --- a/SafeExamBrowser.Contracts/UserInterface/MessageBoxAction.cs +++ b/SafeExamBrowser.Contracts/UserInterface/MessageBoxAction.cs @@ -13,6 +13,7 @@ namespace SafeExamBrowser.Contracts.UserInterface /// public enum MessageBoxAction { - Confirm + Confirm, + YesNo } } diff --git a/SafeExamBrowser.Contracts/UserInterface/MessageBoxIcon.cs b/SafeExamBrowser.Contracts/UserInterface/MessageBoxIcon.cs index 0e530f2c..264eb834 100644 --- a/SafeExamBrowser.Contracts/UserInterface/MessageBoxIcon.cs +++ b/SafeExamBrowser.Contracts/UserInterface/MessageBoxIcon.cs @@ -13,8 +13,9 @@ namespace SafeExamBrowser.Contracts.UserInterface /// public enum MessageBoxIcon { + Error, Information, - Warning, - Error + Question, + Warning } } diff --git a/SafeExamBrowser.Contracts/UserInterface/MessageBoxResult.cs b/SafeExamBrowser.Contracts/UserInterface/MessageBoxResult.cs new file mode 100644 index 00000000..4855fcc2 --- /dev/null +++ b/SafeExamBrowser.Contracts/UserInterface/MessageBoxResult.cs @@ -0,0 +1,19 @@ +/* + * 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/. + */ + +namespace SafeExamBrowser.Contracts.UserInterface +{ + public enum MessageBoxResult + { + None = 0, + Cancel, + No, + Ok, + Yes + } +} diff --git a/SafeExamBrowser.Core/I18n/Text.xml b/SafeExamBrowser.Core/I18n/Text.xml index c85c1b67..01d3d549 100644 --- a/SafeExamBrowser.Core/I18n/Text.xml +++ b/SafeExamBrowser.Core/I18n/Text.xml @@ -2,6 +2,8 @@ Open Console Application Log + The client configuration has been saved and will be used when you start the application the next time. Do you want to quit for now? + Configuration Successful An unexpected error occurred during the shutdown procedure! Please consult the application log for more information... Shutdown Error An unexpected error occurred during the startup procedure! Please consult the application log for more information... diff --git a/SafeExamBrowser.Runtime.UnitTests/Behaviour/Operations/ConfigurationOperationTests.cs b/SafeExamBrowser.Runtime.UnitTests/Behaviour/Operations/ConfigurationOperationTests.cs index f5583165..e9230537 100644 --- a/SafeExamBrowser.Runtime.UnitTests/Behaviour/Operations/ConfigurationOperationTests.cs +++ b/SafeExamBrowser.Runtime.UnitTests/Behaviour/Operations/ConfigurationOperationTests.cs @@ -12,6 +12,7 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; using SafeExamBrowser.Contracts.Configuration; using SafeExamBrowser.Contracts.Configuration.Settings; +using SafeExamBrowser.Contracts.I18n; using SafeExamBrowser.Contracts.Logging; using SafeExamBrowser.Contracts.Runtime; using SafeExamBrowser.Contracts.UserInterface; @@ -26,8 +27,10 @@ namespace SafeExamBrowser.Runtime.UnitTests.Behaviour.Operations private Mock controller; private Mock info; private Mock repository; + private Mock settings; private Mock splashScreen; - + private Mock text; + private Mock uiFactory; private ConfigurationOperation sut; [TestInitialize] @@ -37,11 +40,16 @@ namespace SafeExamBrowser.Runtime.UnitTests.Behaviour.Operations controller = new Mock(); info = new Mock(); repository = new Mock(); + settings = new Mock(); splashScreen = new Mock(); + text = new Mock(); + uiFactory = new Mock(); - info.SetupGet(r => r.AppDataFolder).Returns(@"C:\Not\Really\AppData"); - info.SetupGet(r => r.DefaultSettingsFileName).Returns("SettingsDummy.txt"); - info.SetupGet(r => r.ProgramDataFolder).Returns(@"C:\Not\Really\ProgramData"); + info.SetupGet(i => i.AppDataFolder).Returns(@"C:\Not\Really\AppData"); + info.SetupGet(i => i.DefaultSettingsFileName).Returns("SettingsDummy.txt"); + info.SetupGet(i => i.ProgramDataFolder).Returns(@"C:\Not\Really\ProgramData"); + repository.Setup(r => r.Load(It.IsAny())).Returns(settings.Object); + repository.Setup(r => r.LoadDefaults()).Returns(settings.Object); } [TestMethod] @@ -49,14 +57,14 @@ namespace SafeExamBrowser.Runtime.UnitTests.Behaviour.Operations { controller.SetupSet(c => c.Settings = It.IsAny()); - sut = new ConfigurationOperation(logger.Object, controller.Object, info.Object, repository.Object, null) + sut = new ConfigurationOperation(logger.Object, controller.Object, info.Object, repository.Object, text.Object, uiFactory.Object, null) { SplashScreen = splashScreen.Object }; sut.Perform(); - sut = new ConfigurationOperation(logger.Object, controller.Object, info.Object, repository.Object, new string[] { }) + sut = new ConfigurationOperation(logger.Object, controller.Object, info.Object, repository.Object, text.Object, uiFactory.Object, new string[] { }) { SplashScreen = splashScreen.Object }; @@ -71,7 +79,7 @@ namespace SafeExamBrowser.Runtime.UnitTests.Behaviour.Operations { var path = @"an/invalid\path.'*%yolo/()"; - sut = new ConfigurationOperation(logger.Object, controller.Object, info.Object, repository.Object, new [] { "blubb.exe", path }) + sut = new ConfigurationOperation(logger.Object, controller.Object, info.Object, repository.Object, text.Object, uiFactory.Object, new [] { "blubb.exe", path }) { SplashScreen = splashScreen.Object }; @@ -88,7 +96,7 @@ namespace SafeExamBrowser.Runtime.UnitTests.Behaviour.Operations info.SetupGet(r => r.ProgramDataFolder).Returns(location); info.SetupGet(r => r.AppDataFolder).Returns(location); - sut = new ConfigurationOperation(logger.Object, controller.Object, info.Object, repository.Object, new[] { "blubb.exe", path }) + sut = new ConfigurationOperation(logger.Object, controller.Object, info.Object, repository.Object, text.Object, uiFactory.Object, new[] { "blubb.exe", path }) { SplashScreen = splashScreen.Object }; @@ -107,7 +115,7 @@ namespace SafeExamBrowser.Runtime.UnitTests.Behaviour.Operations info.SetupGet(r => r.ProgramDataFolder).Returns(location); info.SetupGet(r => r.AppDataFolder).Returns($@"{location}\WRONG"); - sut = new ConfigurationOperation(logger.Object, controller.Object, info.Object, repository.Object, null) + sut = new ConfigurationOperation(logger.Object, controller.Object, info.Object, repository.Object, text.Object, uiFactory.Object, null) { SplashScreen = splashScreen.Object }; @@ -125,7 +133,7 @@ namespace SafeExamBrowser.Runtime.UnitTests.Behaviour.Operations info.SetupGet(r => r.AppDataFolder).Returns(location); - sut = new ConfigurationOperation(logger.Object, controller.Object, info.Object, repository.Object, null) + sut = new ConfigurationOperation(logger.Object, controller.Object, info.Object, repository.Object, text.Object, uiFactory.Object, null) { SplashScreen = splashScreen.Object }; @@ -139,7 +147,7 @@ namespace SafeExamBrowser.Runtime.UnitTests.Behaviour.Operations [TestMethod] public void MustFallbackToDefaultsAsLastPrio() { - sut = new ConfigurationOperation(logger.Object, controller.Object, info.Object, repository.Object, null) + sut = new ConfigurationOperation(logger.Object, controller.Object, info.Object, repository.Object, text.Object, uiFactory.Object, null) { SplashScreen = splashScreen.Object }; diff --git a/SafeExamBrowser.Runtime/Behaviour/Operations/ConfigurationOperation.cs b/SafeExamBrowser.Runtime/Behaviour/Operations/ConfigurationOperation.cs index e3c9f8d3..d74f8d29 100644 --- a/SafeExamBrowser.Runtime/Behaviour/Operations/ConfigurationOperation.cs +++ b/SafeExamBrowser.Runtime/Behaviour/Operations/ConfigurationOperation.cs @@ -24,6 +24,8 @@ namespace SafeExamBrowser.Runtime.Behaviour.Operations private IRuntimeController controller; private IRuntimeInfo runtimeInfo; private ISettingsRepository repository; + private IText text; + private IUserInterfaceFactory uiFactory; private string[] commandLineArgs; public ISplashScreen SplashScreen { private get; set; } @@ -33,6 +35,8 @@ namespace SafeExamBrowser.Runtime.Behaviour.Operations IRuntimeController controller, IRuntimeInfo runtimeInfo, ISettingsRepository repository, + IText text, + IUserInterfaceFactory uiFactory, string[] commandLineArgs) { this.logger = logger; @@ -40,6 +44,8 @@ namespace SafeExamBrowser.Runtime.Behaviour.Operations this.commandLineArgs = commandLineArgs; this.repository = repository; this.runtimeInfo = runtimeInfo; + this.text = text; + this.uiFactory = uiFactory; } public void Perform() @@ -47,20 +53,33 @@ namespace SafeExamBrowser.Runtime.Behaviour.Operations logger.Info("Initializing application configuration..."); SplashScreen.UpdateText(TextKey.SplashScreen_InitializeConfiguration); + ISettings settings; var isValidUri = TryGetSettingsUri(out Uri uri); if (isValidUri) { logger.Info($"Loading configuration from '{uri.AbsolutePath}'..."); - controller.Settings = repository.Load(uri); + settings = repository.Load(uri); } else { logger.Info("No valid settings file specified nor found in PROGRAMDATA or APPDATA - loading default settings..."); - controller.Settings = repository.LoadDefaults(); + settings = repository.LoadDefaults(); } - // TODO: Allow user to quit if in Configure Client mode - callback to terminate WPF application? + if (settings.ConfigurationMode == ConfigurationMode.ConfigureClient) + { + var message = text.Get(TextKey.MessageBox_ConfigureClientSuccess); + var title = text.Get(TextKey.MessageBox_ConfigureClientSuccessTitle); + var quitDialogResult = uiFactory.Show(message, title, MessageBoxAction.YesNo, MessageBoxIcon.Question); + + if (quitDialogResult == MessageBoxResult.Yes) + { + // TODO: Callback to terminate WPF application + } + } + + controller.Settings = settings; } public void Revert() diff --git a/SafeExamBrowser.Runtime/CompositionRoot.cs b/SafeExamBrowser.Runtime/CompositionRoot.cs index 48ee9791..d3ba7137 100644 --- a/SafeExamBrowser.Runtime/CompositionRoot.cs +++ b/SafeExamBrowser.Runtime/CompositionRoot.cs @@ -53,7 +53,7 @@ namespace SafeExamBrowser.Runtime StartupOperations = new Queue(); StartupOperations.Enqueue(new I18nOperation(logger, text)); - StartupOperations.Enqueue(new ConfigurationOperation(logger, runtimeController, runtimeInfo, settingsRepository, args)); + StartupOperations.Enqueue(new ConfigurationOperation(logger, runtimeController, runtimeInfo, settingsRepository, text, uiFactory, args)); //StartupOperations.Enqueue(new KioskModeOperation()); StartupOperations.Enqueue(new RuntimeControllerOperation(runtimeController, logger)); } diff --git a/SafeExamBrowser.UserInterface.Classic/UserInterfaceFactory.cs b/SafeExamBrowser.UserInterface.Classic/UserInterfaceFactory.cs index 3990895c..961d7b35 100644 --- a/SafeExamBrowser.UserInterface.Classic/UserInterfaceFactory.cs +++ b/SafeExamBrowser.UserInterface.Classic/UserInterfaceFactory.cs @@ -15,6 +15,7 @@ using SafeExamBrowser.Contracts.Logging; using SafeExamBrowser.Contracts.UserInterface; using SafeExamBrowser.Contracts.UserInterface.Taskbar; using SafeExamBrowser.UserInterface.Classic.Controls; +using MessageBoxResult = SafeExamBrowser.Contracts.UserInterface.MessageBoxResult; namespace SafeExamBrowser.UserInterface.Classic { @@ -105,15 +106,21 @@ namespace SafeExamBrowser.UserInterface.Classic return new WirelessNetworkControl(); } - public void Show(string message, string title, MessageBoxAction action = MessageBoxAction.Confirm, MessageBoxIcon icon = MessageBoxIcon.Information) + public MessageBoxResult Show(string message, string title, MessageBoxAction action = MessageBoxAction.Confirm, MessageBoxIcon icon = MessageBoxIcon.Information) { - MessageBox.Show(message, title, ToButton(action), ToImage(icon)); + // The last two parameters are an unfortunate necessity, since e.g. splash screens are displayed topmost while running in their + // own thread / dispatcher, and would thus conceal the message box... + var result = MessageBox.Show(message, title, ToButton(action), ToImage(icon), System.Windows.MessageBoxResult.None, MessageBoxOptions.ServiceNotification); + + return ToResult(result); } private MessageBoxButton ToButton(MessageBoxAction action) { switch (action) { + case MessageBoxAction.YesNo: + return MessageBoxButton.YesNo; default: return MessageBoxButton.OK; } @@ -123,13 +130,32 @@ namespace SafeExamBrowser.UserInterface.Classic { switch (icon) { - case MessageBoxIcon.Warning: - return MessageBoxImage.Warning; case MessageBoxIcon.Error: return MessageBoxImage.Error; + case MessageBoxIcon.Question: + return MessageBoxImage.Question; + case MessageBoxIcon.Warning: + return MessageBoxImage.Warning; default: return MessageBoxImage.Information; } } + + private MessageBoxResult ToResult(System.Windows.MessageBoxResult result) + { + switch (result) + { + case System.Windows.MessageBoxResult.Cancel: + return MessageBoxResult.Cancel; + case System.Windows.MessageBoxResult.No: + return MessageBoxResult.No; + case System.Windows.MessageBoxResult.OK: + return MessageBoxResult.Ok; + case System.Windows.MessageBoxResult.Yes: + return MessageBoxResult.Yes; + default: + return MessageBoxResult.None; + } + } } } diff --git a/SafeExamBrowser.UserInterface.Windows10/UserInterfaceFactory.cs b/SafeExamBrowser.UserInterface.Windows10/UserInterfaceFactory.cs index 6545e3f9..75f1ef37 100644 --- a/SafeExamBrowser.UserInterface.Windows10/UserInterfaceFactory.cs +++ b/SafeExamBrowser.UserInterface.Windows10/UserInterfaceFactory.cs @@ -15,6 +15,7 @@ using SafeExamBrowser.Contracts.Logging; using SafeExamBrowser.Contracts.UserInterface; using SafeExamBrowser.Contracts.UserInterface.Taskbar; using SafeExamBrowser.UserInterface.Windows10.Controls; +using MessageBoxResult = SafeExamBrowser.Contracts.UserInterface.MessageBoxResult; namespace SafeExamBrowser.UserInterface.Windows10 { @@ -107,15 +108,21 @@ namespace SafeExamBrowser.UserInterface.Windows10 throw new System.NotImplementedException(); } - public void Show(string message, string title, MessageBoxAction action = MessageBoxAction.Confirm, MessageBoxIcon icon = MessageBoxIcon.Information) + public MessageBoxResult Show(string message, string title, MessageBoxAction action = MessageBoxAction.Confirm, MessageBoxIcon icon = MessageBoxIcon.Information) { - MessageBox.Show(message, title, ToButton(action), ToImage(icon)); + // The last two parameters are an unfortunate necessity, since e.g. splash screens are displayed topmost while running in their + // own thread / dispatcher, and would thus conceal the message box... + var result = MessageBox.Show(message, title, ToButton(action), ToImage(icon), System.Windows.MessageBoxResult.None, MessageBoxOptions.ServiceNotification); + + return ToResult(result); } private MessageBoxButton ToButton(MessageBoxAction action) { switch (action) { + case MessageBoxAction.YesNo: + return MessageBoxButton.YesNo; default: return MessageBoxButton.OK; } @@ -125,13 +132,32 @@ namespace SafeExamBrowser.UserInterface.Windows10 { switch (icon) { - case MessageBoxIcon.Warning: - return MessageBoxImage.Warning; case MessageBoxIcon.Error: return MessageBoxImage.Error; + case MessageBoxIcon.Question: + return MessageBoxImage.Question; + case MessageBoxIcon.Warning: + return MessageBoxImage.Warning; default: return MessageBoxImage.Information; } } + + private MessageBoxResult ToResult(System.Windows.MessageBoxResult result) + { + switch (result) + { + case System.Windows.MessageBoxResult.Cancel: + return MessageBoxResult.Cancel; + case System.Windows.MessageBoxResult.No: + return MessageBoxResult.No; + case System.Windows.MessageBoxResult.OK: + return MessageBoxResult.Ok; + case System.Windows.MessageBoxResult.Yes: + return MessageBoxResult.Yes; + default: + return MessageBoxResult.None; + } + } } }