private void AddButton_Click(object sender, RoutedEventArgs e) { TrimAllTextBoxes(); if (!AllTextBoxesHaveData()) { DialogResult = false; return; } var id = IdTextBox.Text; var name = NameTextBox.Text; var description = DescriptionTextBox.Text; var location = LocationTextBox.Text; bool result; if (bluRadioButton.IsChecked != null && (bool)bluRadioButton.IsChecked) { result = DatabaseHandler.AddBluOrSlt("BLU", id, name, description, location); if (result) { statusLogConfig.FindAndSelectRowIfExists(statusLogConfig.dgBLU, id); statusLogConfig.SetStatusLabelTextWithClearTimer($"Added BLU {id}."); } } else { result = DatabaseHandler.AddBluOrSlt("SLT", id, name, description, location); if (result) { statusLogConfig.FindAndSelectRowIfExists(statusLogConfig.dgSLT, id); statusLogConfig.SetStatusLabelTextWithClearTimer($"Added SLT {id}."); } } DialogResult = result; }