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; }
private async void ShowResults(BiomassSensorInformation si) { BiomassSensorInformationWindow piw = new BiomassSensorInformationWindow("Save Sensor Calibration", true, si); piw.Show(); await piw.WaitTask; if (piw.Confirmed) { System.Windows.Forms.FolderBrowserDialog fbd = new System.Windows.Forms.FolderBrowserDialog(); fbd.ShowDialog(); if (Directory.Exists(fbd.SelectedPath)) { si.SaveTo(fbd.SelectedPath); } } }