示例#1
0
 private void doDeleteConfig()
 {
     TranscribeEndpoints.Remove(SelectedTranscribeEndpoint);
     SaveEndpointsFile();
     SelectedTranscribeEndpoint = null;
     LoadEndpointsFile();
 }
示例#2
0
        private void doNewConfigSave()
        {
            var currentValues = SelectedTranscribeEndpoint;

            LoadEndpointsFile();                        // reset before changes
            TranscribeEndpoints.Add(currentValues);     // add back in
            SaveEndpointsFile();
            SelectedTranscribeEndpoint = currentValues; // select again
        }
示例#3
0
        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);
            }
        }