Exemplo n.º 1
0
        private void OnStartAcq()
        {
            if (bool.Parse(ConfigurationManager.AppSettings["standalone"]))
            {
                OnStartAcqStandAlone();
                return;
            }

            log.Info("start acquisition");
            if (lstboxPlates.SelectedItem == null)
            {
                log.Info("Please select a plate first!");
                return;
            }


            string folder = GlobalVars.Instance.ResultFolder;
            var    files  = Directory.EnumerateFiles(folder, "*.asc");

            if (files == null || files.Count() == 0)
            {
                log.Error("Cannot read the result file.");
                return;
            }
            string sNewFile = files.OrderByDescending(x => x).First();

            log.Info(string.Format("found result file: {0}", sNewFile));
            try
            {
                var result = Utility.ReadFromFile(sNewFile);
                log.InfoFormat("read {0} samples.", result.Count);
                GlobalVars.Instance.PlatesInfo.CurrentPlateData.SetValues(result);
                UpdateCurrentPlateInfo(GlobalVars.Instance.PlatesInfo.CurrentPlateName);
                ExcelInterop.Write();
                log.Info(string.Format("Result has been written to plate: {0}", GlobalVars.Instance.PlatesInfo.CurrentPlateName));
                Utility.BackupFiles();
            }
            catch (Exception ex)
            {
                Trace.Write("Error happend: " + ex.Message);
            }
            NotifierReady();
        }
Exemplo n.º 2
0
 private void fileWatcher_onCreated(string sNewFile)
 {
     MainWindow.log.Info(string.Format("found result file: {0}", sNewFile));
     try
     {
         List <double> list = Utility.ReadFromFile(sNewFile);
         MainWindow.log.InfoFormat("read {0} samples.", list.Count);
         GlobalVars.Instance.PlatesInfo.CurrentPlateData.SetValues(list);
         this.UpdateCurrentPlateInfo(GlobalVars.Instance.PlatesInfo.CurrentPlateName, true);
         ExcelInterop.Write();
         this.fileWatcher.onCreated -= new FileWatcher.Created(this.fileWatcher_onCreated);
         MainWindow.log.Info(string.Format("Result has been written to plate: {0}", GlobalVars.Instance.PlatesInfo.CurrentPlateName));
     }
     catch (Exception ex)
     {
         Trace.Write("Error happend: " + ex.Message);
     }
     this.NotifierReady();
 }