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();