private void doDeleteConfig() { TranscribeEndpoints.Remove(SelectedTranscribeEndpoint); SaveEndpointsFile(); SelectedTranscribeEndpoint = null; LoadEndpointsFile(); }
private void doNewConfigSave() { var currentValues = SelectedTranscribeEndpoint; LoadEndpointsFile(); // reset before changes TranscribeEndpoints.Add(currentValues); // add back in SaveEndpointsFile(); SelectedTranscribeEndpoint = currentValues; // select again }
public void SaveEndpointsFile() { if (!Directory.Exists(settingsVM.ProjectsFolder)) { Directory.CreateDirectory(settingsVM.ProjectsFolder); } try { DataContractSerializer ser = new DataContractSerializer(typeof(List <SpeechEndpointConfig>)); var xmlSettings = new XmlWriterSettings { Indent = true, IndentChars = "\t" }; using (var writer = XmlWriter.Create(settingsVM.TranscribeEndpointsFile, xmlSettings)) { ser.WriteObject(writer, TranscribeEndpoints.ToList()); } } catch (Exception exc) { var msg = $"Error serialising or saving the projects file: {exc}"; MessageBox.Show(msg); } }