From 691daeccfa6818d2e15f82cfc2c35385ca52c2d4 Mon Sep 17 00:00:00 2001 From: J0seph0 <103216770+J0seph0@users.noreply.github.com> Date: Sun, 17 Mar 2024 20:12:22 -0700 Subject: [PATCH] Fixed the output to text and csv --- ActiveDirectoryQuerier/MainWindowViewModel.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/ActiveDirectoryQuerier/MainWindowViewModel.cs b/ActiveDirectoryQuerier/MainWindowViewModel.cs index 529c204..34f21d4 100644 --- a/ActiveDirectoryQuerier/MainWindowViewModel.cs +++ b/ActiveDirectoryQuerier/MainWindowViewModel.cs @@ -360,7 +360,8 @@ private void CreateNewQueryFile(object _) saveFileDialog.Filter = "Json files (*.json)|*.json|Text files (*.txt)|*.txt"; if (saveFileDialog.ShowDialog() == true) { - File.WriteAllText(saveFileDialog.FileName, string.Empty); + QueryButtonStackPanel.Clear(); + //File.WriteAllText(saveFileDialog.FileName, string.Empty); _customQuery.CustomQueryFileLocation = saveFileDialog.FileName; } } @@ -504,7 +505,7 @@ private void AddCommandComboBoxInQueryBuilder(object _) private async void OutputExecutionResultsToTextFileAsync(object _) { - if (_.GetType() == typeof(Button)) + if (_ is not null) { var currentButton = _ as Button; Query buttonQuery; @@ -545,7 +546,7 @@ private async void OutputExecutionResultsToTextFileAsync(object _) private async void OutputExecutionResultsToCsvFileAsync(object _) { - if (_.GetType() == typeof(Button)) + if (_ is not null) { var currentButton = _ as Button; Query buttonQuery; @@ -762,6 +763,8 @@ private void ClearQueryBuilder(object _) // If the user selects yes, clear the console if (result == MessageBoxResult.Yes) { + QueryName = ""; + QueryDescription = ""; SelectedCommandFromComboBoxInQueryBuilder = null; DynamicallyAvailableADCommandParametersComboBox.Clear(); DynamicallyAvailableADCommandParameterValueTextBox.Clear();