Ejemplo n.º 1
0
        private void ScanSensorDirectory()
        {
            Dictionary<string, BiomassSensorInformation> newBiomassSensors = new Dictionary<string, BiomassSensorInformation>();
            Dictionary<string, GasSensorInformation> newGasSensors = new Dictionary<string, GasSensorInformation>();

            foreach (string file in Directory.EnumerateFiles(sensorDirectory, "*.biomass"))
            {
                BiomassSensorInformation sensor = BiomassSensorInformation.LoadFromFile(file);
                if (sensor != null)
                {
                    sensor.EditSensorCommand = new RelayCommand(async delegate
                    {
                        BiomassSensorInformationWindow bsiw = new BiomassSensorInformationWindow("Sensor Calibration", false, sensor);
                        bsiw.Show();
                        await bsiw.WaitTask;
                    });
                    newBiomassSensors.Add(sensor.SensorID, sensor);
                }

            }
            foreach (string file in Directory.EnumerateFiles(sensorDirectory, "*.sensor"))
            {
                GasSensorInformation sensor = GasSensorInformation.LoadFromFile(file);
                if (sensor != null)
                {
                    sensor.EditSensorCommand = new RelayCommand(async delegate
                    {
                        GasSensorInformationWindow bsiw = new GasSensorInformationWindow("Sensor Calibration", false, sensor);
                        bsiw.Show();
                        await bsiw.WaitTask;
                    });
                    newGasSensors.Add(sensor.SensorID, sensor);
                }
            }

            BiomassSensors = newBiomassSensors;
            GasSensors = newGasSensors;
        }
Ejemplo n.º 2
0
 private async void PrepareResults()
 {
     GasSensorInformation si = new GasSensorInformation();
     foreach (Subcalibration sub in Subcalibrations)
         if (!double.IsNaN(sub.ResponsePoint.Analog))
             si.ResponseCurve.Add(sub.ResponsePoint);
     GasSensorInformationWindow gsiw = new GasSensorInformationWindow("Save Sensor Calibration", true, si);
     gsiw.Show();
     await gsiw.WaitTask;
     if (gsiw.Confirmed)
     {
         System.Windows.Forms.FolderBrowserDialog fbd = new System.Windows.Forms.FolderBrowserDialog();
         fbd.ShowDialog();
         if (Directory.Exists(fbd.SelectedPath))
         {
             si.SaveTo(fbd.SelectedPath);
         }
     }
 }