Ejemplo n.º 1
0
 private void OnImport(ImportForm import)
 {
     string[] bufferToImport = import.ImportBuffer.Split('\n');
     foreach (string item in bufferToImport)
     {
         if (item.Equals(string.Empty))
         {
             continue;
         }
         string[] words = item.Split(' ');
         string   tmpID = string.Empty;
         if (words.Length < 5 || !importTranslateCheck.Checked)
         {
             tmpID = "DefaultID";
         }
         else
         {
             for (int i = 0; i < 3; i++)
             {
                 if (words[i].Any(char.IsPunctuation))
                 {
                     continue;
                 }
                 tmpID += words[i] + " ";
             }
             tmpID = TextTranslator.TranslateToEng(tmpID);
         }
         protocolElements.Add(new ProtocolElementModel
         {
             ID    = tmpID,
             Value = item.Replace("\r", string.Empty)
         });
     }
 }
Ejemplo n.º 2
0
        private void OnImportTxt(ImportForm import)
        {
            //List<string> Names = new List<string>();
            List <string> Values = new List <string>();

            string[] bufferToImport = import.ImportBuffer.Split('\n');
            foreach (var item in bufferToImport)
            {
                //if (item.Contains("Name="))
                //{
                //    string tmp = item.Remove(0, item.IndexOf("Name=\"") + "Name=\"".Length);
                //    tmp = tmp.Remove(tmp.IndexOf('\"'));
                //    Names.Add(tmp);
                //}
                if (item.Contains("Value="))
                {
                    string tmp = item.Remove(0, item.IndexOf("Value=\"") + "Value=\"".Length);
                    tmp = tmp.Remove(tmp.IndexOf('\"'));
                    Values.Add(tmp);
                }
            }
            string value = string.Empty;

            foreach (var item in Values)
            {
                value += item + "\\r\\n";
            }
            protocolElements.Add(new ProtocolElementModel
            {
                ID    = "Diagnosis",
                Value = value.Remove(value.LastIndexOf("\\r\\n"))
            });
        }
Ejemplo n.º 3
0
        private async void ImportTxtBtn_Click(object sender, EventArgs e)
        {
            ImportForm import = new ImportForm();

            import.ShowDialog();
            if (string.IsNullOrEmpty(import.ImportBuffer))
            {
                return;
            }
            LoadingPictureBox.Visible = true;
            LoadingPictureBox.BringToFront();
            await Task.Run(() => OnImportTxt(import));

            LoadingPictureBox.SendToBack();
            LoadingPictureBox.Visible = false;
        }