diff --git a/ActiveDirectoryQuerier/MainWindowViewModel.cs b/ActiveDirectoryQuerier/MainWindowViewModel.cs index a155491..b12eb06 100644 --- a/ActiveDirectoryQuerier/MainWindowViewModel.cs +++ b/ActiveDirectoryQuerier/MainWindowViewModel.cs @@ -369,7 +369,7 @@ private void LoadSavedQueriesFromFile() _customQuery.LoadData(); // Loop through the queries and create a button for each one. - foreach (var newButton in _customQuery.Queries.Select(CreateCustomButton)) + foreach (var newButton in _customQuery.Queries.Select(CreateQueryButtonInStackPanel)) { // Lastly add the button to the stack panel QueryButtonStackPanel.Add(newButton); @@ -628,8 +628,7 @@ private void GetCurrentQuery() string[] commandParameters; string[] commandParameterValues; - if (SelectedCommandFromComboBoxInQueryBuilder is not null && - SelectedCommandFromComboBoxInQueryBuilder.Parameters is not null) + if (SelectedCommandFromComboBoxInQueryBuilder?.Parameters != null) { commandParameters = new string[SelectedCommandFromComboBoxInQueryBuilder.Parameters.Count]; commandParameterValues = new string[SelectedCommandFromComboBoxInQueryBuilder.Parameters.Count]; @@ -705,7 +704,7 @@ private void SaveQuery(object commandParameter) _customQuery.SerializeCommand(SelectedCommandFromComboBoxInQueryBuilder, QueryName, QueryDescription); - Button newButton = CreateCustomButton(); + Button newButton = CreateQueryButtonInStackPanel(); QueryButtonStackPanel.Add(newButton); } @@ -744,13 +743,7 @@ private void ClearQueryBuilder(object _) } } - /// - /// This method is for creating buttons, right now it creates it off of the current/selectedcommand parameters but - /// could be changed to also do it from the query list. - /// - /// This method returns a button that has been customized for the custom query list - /// TODO: Change method name? - private Button CreateCustomButton(Query? query = null) + private Button CreateQueryButtonInStackPanel(Query? query = null) { Button newButton = new();