private void doNewConfigSave() { if (string.IsNullOrWhiteSpace(SelectedVoiceEndpoint.Endpoint) || string.IsNullOrWhiteSpace(SelectedVoiceEndpoint.Name) || string.IsNullOrWhiteSpace(SelectedVoiceEndpoint.Region) || string.IsNullOrWhiteSpace(SelectedVoiceEndpoint.Key)) { MessageBox.Show("Please make sure all the endpoint fields are completed"); return; } var currentValues = SelectedVoiceEndpoint; LoadEndpointsFile(); // reset before changes VoiceEndpoints.Add(currentValues); // add back in SaveEndpointsFile(); SelectedVoiceEndpoint = currentValues; // select again }