From 465336080e6689468c13ea1f8a2b0d4cd0f8352c Mon Sep 17 00:00:00 2001 From: Toni Schmitt Date: Fri, 18 Dec 2020 14:48:23 +0100 Subject: [PATCH] Cleaned up UnitTestWindow Class --- Packer/UnitTestWindow.xaml.cs | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/Packer/UnitTestWindow.xaml.cs b/Packer/UnitTestWindow.xaml.cs index d0f041d..197fda8 100644 --- a/Packer/UnitTestWindow.xaml.cs +++ b/Packer/UnitTestWindow.xaml.cs @@ -1,16 +1,7 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; using System.Threading.Tasks; using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Shapes; namespace Packer { @@ -22,11 +13,19 @@ public partial class UnitTestWindow : Window public UnitTestWindow() { InitializeComponent(); + // Center Window windowUnitTest.WindowStartupLocation = WindowStartupLocation.CenterScreen; } + + /// + /// Sets the destination directory where the files of the Unit Test are + /// + /// + /// private void ClickDestDir(object sender, MouseButtonEventArgs e) { + // Initializes an CommonOpenFileDialog for choosing a folder Microsoft.WindowsAPICodePack.Dialogs.CommonOpenFileDialog openFileDialog = new Microsoft.WindowsAPICodePack.Dialogs.CommonOpenFileDialog { IsFolderPicker = true, @@ -41,14 +40,22 @@ private void ClickDestDir(object sender, MouseButtonEventArgs e) } } + /// + /// Starts UnitTest + /// + /// + /// private async void ClickStartTest(object sender, RoutedEventArgs e) { + // Disables buttons so that user knows Unit Test is in progress destinationDirectory.IsEnabled = false; startTest.IsEnabled = false; analyze.IsEnabled = false; + // Starts Unit Test as background Thread await Task.Run(() => UnitTest.StartTest()); + // Enables buttons so that user knows UnitTest is done destinationDirectory.IsEnabled = true; startTest.IsEnabled = true; analyze.IsEnabled = true;