public PreparationExecuter(ExerciceVM currentActivity) { this.Player = new WAVPlayerRecorder(); this.CurrentActivity = currentActivity; this.scripting = new PraatScripting(currentActivity.Name); this.connector = PraatConnector.GetConnector(); this.currentExercicePath = CurrentActivity.Example_wav_path; this.exerciceFolderPath = Environment.GetEnvironmentVariable("LocalAppData") + "\\MyOrtho\\" + this.CurrentActivity.Name + "\\"; if (!Directory.Exists(this.exerciceFolderPath)) { Directory.CreateDirectory(this.exerciceFolderPath); } /*File.Copy(CurrentActivity.Example_wav_path, exerciceFolderPath + CurrentActivity.Name, true); * string currentExerciceFilePath = (this.exerciceFolderPath + "exercice" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".txt"); * * Task.Run(() => this.CurrentActivity.Exercice = CalculateIntensityAndFrequency(this.CurrentActivity.Example_wav_path, currentExerciceFilePath));*/ }
private void populateResultsList(string path, SuiviVM activityList) { XDocument xml = XDocument.Load(path + "\\resultats.xml"); var activities = xml.Descendants("Activity"); foreach (XElement activity in activities) { ExerciceVM newExerciceResult = new ExerciceVM { Name = activity.Descendants("Name").First().Value, Example_wav_path = path + "\\" + activity.Descendants("Exercice_wav_file_name").First().Value, Result_wav_path = path + "\\" + activity.Descendants("Result_wav_filename").First().Value, /*PitchMin = Convert.ToInt32(activity.Descendants("Pitch_min").First().Value), * PitchMax = Convert.ToInt32(activity.Descendants("Pitch_max").First().Value), * IntensityThreshold = Convert.ToInt32(activity.Descendants("Intensity_threshold").First().Value), * F0_exactEvaluated = Convert.ToBoolean(activity.Descendants("F0_exactEvaluated").First().Value), * F0_stableEvaluated = Convert.ToBoolean(activity.Descendants("F0_stableEvaluated").First().Value), * Intensite_stableEvaluated = Convert.ToBoolean(activity.Descendants("Intensite_stableEvaluated").First().Value), * Courbe_f0_exacteEvaluated = Convert.ToBoolean(activity.Descendants("Courbe_f0_exacteEvaluated").First().Value), * Duree_exacteEvaluated = Convert.ToBoolean(activity.Descendants("Duree_exacteEvaluated").First().Value), * JitterEvaluated = Convert.ToBoolean(activity.Descendants("JitterEvaluated").First().Value),*/ F0_exact = Decimal.Parse(activity.Descendants("F0_exact").First().Value, System.Globalization.NumberStyles.Float), F0_stable = Decimal.Parse(activity.Descendants("F0_stable").First().Value, System.Globalization.NumberStyles.Float), Intensite_stable = Decimal.Parse(activity.Descendants("Intensite_stable").First().Value, System.Globalization.NumberStyles.Float), Courbe_f0_exacte = Decimal.Parse(activity.Descendants("Courbe_f0_exacte").First().Value, System.Globalization.NumberStyles.Float), Duree_exacte = Decimal.Parse(activity.Descendants("Duree_exacte").First().Value, System.Globalization.NumberStyles.Float), Jitter = Decimal.Parse(activity.Descendants("Jitter").First().Value, System.Globalization.NumberStyles.Float) }; ICollection <DataLineItem> points = activity.Descendants("PointExercice").Select(x => new DataLineItem { Time = double.Parse(x.Descendants("Time").First().Value), Intensity = double.Parse(x.Descendants("Intensity").First().Value), Pitch = double.Parse(x.Descendants("Pitch").First().Value) }).ToList(); newExerciceResult.Exercice = points; ICollection <DataLineItem> resultsPoints = activity.Descendants("PointResultat").Select(x => new DataLineItem { Time = double.Parse(x.Descendants("Time").First().Value), Intensity = double.Parse(x.Descendants("Intensity").First().Value), Pitch = double.Parse(x.Descendants("Pitch").First().Value) }).ToList(); newExerciceResult.Results = resultsPoints; activityList.Add(newExerciceResult); } }
public CreationExecuter(ExerciceVM currentActivity) { this.Player = new WAVPlayerRecorder(); this.CurrentActivity = currentActivity; this.scripting = new PraatScripting(currentActivity.Name); this.connector = PraatConnector.GetConnector(); TempExWavPath = CurrentActivity.Example_wav_path; this.tempRecordingsLocation = TEMP_PATH; if (!Directory.Exists(TEMP_PATH)) { Directory.CreateDirectory(TEMP_PATH); } string currentExerciceFilePath = (TEMP_PATH + "TempPraatResults_" + currentActivity.Date + ".txt"); string praatScriptTargetPath = (TEMP_PATH + "TempScript_" + currentActivity.Date + ".praat"); //string currentExerciceFilePath2 = (this.tempRecordingsLocation + "_" + CurrentActivity.Date + ".txt"); Task.Run(() => this.CurrentActivity.Exercice = CalculateIntensityAndFrequency(this.CurrentActivity.Example_wav_path, currentExerciceFilePath, praatScriptTargetPath)); }
private void UpdateChartsAndActivity() { ExerciceVM activity = ActivityListInstance.CurrentExercice; activity.Date = recordStartDate; activity.Example_wav_path = txtFileName.Text; /*ExerciceVM activity = new ExerciceVM * { * Example_wav_path = txtFileName.Text, * Date = recordStartDate, * Name = txtName.Text, * PitchMin = Convert.ToInt32(txtPitchMin.Text), * PitchMax = Convert.ToInt32(txtPitchMax.Text), * IntensityThreshold = Convert.ToInt32(txtIntensityThreshold.Text), * Duree_exacte = Convert.ToInt32(txtDuration.Text) * };*/ activity.SetExerciseValue(values => SetChartLine((LineSeries)PitchChart.Series[0], (LineSeries)IntensityChart.Series[0], values)); ce = new CreationExecuter(activity); tempExercicePraatResultsPath = ce.TempExPraatResultsPath; }
public static XmlNode MakeActivityNode(ExerciceVM activity) { var configFile = new XmlHelper(false); XmlElement activityNode = configFile.AddToRoot("Activity", string.Empty); configFile.AppendToNode(activityNode, "Name", activity.Name); configFile.AppendToNode(activityNode, "Exercice_wav_file_name", activity.Example_wav_path); var exerciceResults = configFile.AppendToNode(activityNode, "Exercice_praat_results", string.Empty); XmlElement pointNode; foreach (var point in activity.Exercice) { pointNode = configFile.AppendToNode(exerciceResults, "point", string.Empty); configFile.AppendToNode(pointNode, "time", point.Time.ToString("F2")); configFile.AppendToNode(pointNode, "frequency", point.Intensity.ToString("F2")); configFile.AppendToNode(pointNode, "pitch", point.Pitch.ToString("F2")); } configFile.AppendToNode(activityNode, "Pitch_min", activity.PitchMin.ToString()); configFile.AppendToNode(activityNode, "Pitch_max", activity.PitchMax.ToString()); configFile.AppendToNode(activityNode, "Intensity_threshold", activity.IntensityThreshold.ToString()); configFile.AppendToNode(activityNode, "F0_exactEvaluated", activity.F0_exactEvaluated.ToString()); configFile.AppendToNode(activityNode, "Courbe_f0_exacteEvaluated", activity.Courbe_f0_exacteEvaluated.ToString()); configFile.AppendToNode(activityNode, "F0_stableEvaluated", activity.F0_stableEvaluated.ToString()); configFile.AppendToNode(activityNode, "Intensite_stableEvaluated", activity.Intensite_stableEvaluated.ToString()); configFile.AppendToNode(activityNode, "Duree_exacteEvaluated", activity.Duree_exacteEvaluated.ToString()); configFile.AppendToNode(activityNode, "Duree_exacte", activity.Duree_exacte.ToString()); configFile.AppendToNode(activityNode, "JitterEvaluated", activity.JitterEvaluated.ToString()); var f0_exacte_evaluation = configFile.AppendToNode(activityNode, "F0_exacte_evaluation", string.Empty); var good = configFile.AppendToNode(f0_exacte_evaluation, "Good", string.Empty); configFile.AppendToNode(good, "Max", activity.F0_exact_good_max.ToString()); configFile.AppendToNode(good, "Min", activity.F0_exact_good_min.ToString()); var okay = configFile.AppendToNode(f0_exacte_evaluation, "Okay", string.Empty); configFile.AppendToNode(okay, "Max", activity.F0_exact_okay_max.ToString()); configFile.AppendToNode(okay, "Min", activity.F0_exact_okay_min.ToString()); var bad = configFile.AppendToNode(f0_exacte_evaluation, "Bad", string.Empty); configFile.AppendToNode(bad, "Max", activity.F0_exact_bad_max.ToString()); configFile.AppendToNode(bad, "Min", activity.F0_exact_bad_min.ToString()); var f0_stable_evaluation = configFile.AppendToNode(activityNode, "F0_stable_evaluation", string.Empty); good = configFile.AppendToNode(f0_stable_evaluation, "Good", string.Empty); configFile.AppendToNode(good, "Max", activity.F0_stable_good_max.ToString()); configFile.AppendToNode(good, "Min", activity.F0_stable_good_min.ToString()); okay = configFile.AppendToNode(f0_stable_evaluation, "Okay", string.Empty); configFile.AppendToNode(okay, "Max", activity.F0_stable_okay_max.ToString()); configFile.AppendToNode(okay, "Min", activity.F0_stable_okay_min.ToString()); bad = configFile.AppendToNode(f0_stable_evaluation, "Bad", string.Empty); configFile.AppendToNode(bad, "Max", activity.F0_stable_bad_max.ToString()); configFile.AppendToNode(bad, "Min", activity.F0_stable_bad_min.ToString()); var intensite_stable_evaluation = configFile.AppendToNode(activityNode, "Intensite_stable_evaluation", string.Empty); good = configFile.AppendToNode(intensite_stable_evaluation, "Good", string.Empty); configFile.AppendToNode(good, "Max", activity.Intensite_stable_good_max.ToString()); configFile.AppendToNode(good, "Min", activity.Intensite_stable_good_min.ToString()); okay = configFile.AppendToNode(intensite_stable_evaluation, "Okay", string.Empty); configFile.AppendToNode(okay, "Max", activity.Intensite_stable_okay_max.ToString()); configFile.AppendToNode(okay, "Min", activity.Intensite_stable_okay_min.ToString()); bad = configFile.AppendToNode(intensite_stable_evaluation, "Bad", string.Empty); configFile.AppendToNode(bad, "Max", activity.Intensite_stable_bad_max.ToString()); configFile.AppendToNode(bad, "Min", activity.Intensite_stable_bad_min.ToString()); var courbe_F0_exacte_evaluation = configFile.AppendToNode(activityNode, "Courbe_F0_exacte_evaluation", string.Empty); good = configFile.AppendToNode(courbe_F0_exacte_evaluation, "Good", string.Empty); configFile.AppendToNode(good, "Max", activity.Courbe_F0_exact_good_max.ToString()); configFile.AppendToNode(good, "Min", activity.Courbe_F0_exact_good_min.ToString()); okay = configFile.AppendToNode(courbe_F0_exacte_evaluation, "Okay", string.Empty); configFile.AppendToNode(okay, "Max", activity.Courbe_F0_exact_okay_max.ToString()); configFile.AppendToNode(okay, "Min", activity.Courbe_F0_exact_okay_min.ToString()); bad = configFile.AppendToNode(courbe_F0_exacte_evaluation, "Bad", string.Empty); configFile.AppendToNode(bad, "Max", activity.Courbe_F0_exact_bad_max.ToString()); configFile.AppendToNode(bad, "Min", activity.Courbe_F0_exact_bad_min.ToString()); var duree_exacte_evaluation = configFile.AppendToNode(activityNode, "Duree_exacte_evaluation", string.Empty); good = configFile.AppendToNode(duree_exacte_evaluation, "Good", string.Empty); configFile.AppendToNode(good, "Max", activity.Duree_good_max.ToString()); configFile.AppendToNode(good, "Min", activity.Duree_good_min.ToString()); okay = configFile.AppendToNode(duree_exacte_evaluation, "Okay", string.Empty); configFile.AppendToNode(okay, "Max", activity.Duree_okay_max.ToString()); configFile.AppendToNode(okay, "Min", activity.Duree_okay_min.ToString()); bad = configFile.AppendToNode(duree_exacte_evaluation, "Bad", string.Empty); configFile.AppendToNode(bad, "Max", activity.Duree_bad_max.ToString()); configFile.AppendToNode(bad, "Min", activity.Duree_bad_min.ToString()); var jitter_evaluation = configFile.AppendToNode(activityNode, "Jitter_evaluation", string.Empty); good = configFile.AppendToNode(jitter_evaluation, "Good", string.Empty); configFile.AppendToNode(good, "Max", activity.Jitter_good_max.ToString()); configFile.AppendToNode(good, "Min", activity.Jitter_good_min.ToString()); okay = configFile.AppendToNode(jitter_evaluation, "Okay", string.Empty); configFile.AppendToNode(okay, "Max", activity.Jitter_okay_max.ToString()); configFile.AppendToNode(okay, "Min", activity.Jitter_okay_min.ToString()); bad = configFile.AppendToNode(jitter_evaluation, "Bad", string.Empty); configFile.AppendToNode(bad, "Max", activity.Jitter_bad_max.ToString()); configFile.AppendToNode(bad, "Min", activity.Jitter_bad_min.ToString()); return(activityNode); }
private void BtnCreerExercice_Click(object sender, RoutedEventArgs e) { //TODO: enregistrer le fichier comme exercice tempExercicePraatResultsPath = ce.TempExPraatResultsPath; string xmlFileName = (txtName.Text + "_" + recordStartDate + ".xml").Replace(' ', '_'); string wavFileName = (txtName.Text + "_recording_" + recordStartDate + ".wav").Replace(' ', '_'); string txtFileName = (txtName.Text + "_praat_" + recordStartDate + ".txt").Replace(' ', '_'); string targetXMLPath = EXERCICES_FOLDER + "\\" + xmlFileName; string savedWavPath = EXERCICES_FOLDER + "\\" + wavFileName; string savedPraatResultsPath = EXERCICES_FOLDER + "\\" + txtFileName; string type = (bool)radTypeLigne.IsChecked ? "Droite" : "Courbe"; int pitchMax; int pitchMin; int intensityThreshold; int duree; int.TryParse(txtPitchMax.Text, out pitchMax); int.TryParse(txtPitchMin.Text, out pitchMin); int.TryParse(txtIntensityThreshold.Text, out intensityThreshold); int.TryParse(txtDuration.Text, out duree); if (!Directory.Exists(EXERCICES_FOLDER)) { Directory.CreateDirectory(EXERCICES_FOLDER); } File.Copy(tempExerciceWavPath, savedWavPath); File.Copy(tempExercicePraatResultsPath, savedPraatResultsPath); var activityVM = new ExerciceVM { Name = txtName.Text, Example_wav_path = wavFileName, Exercice = ce.EnumerateCurrentPoints(), PitchMin = pitchMin, PitchMax = pitchMax, IntensityThreshold = intensityThreshold, F0_exactEvaluated = chkF0ExacteEvaluated.IsChecked.Value, Courbe_f0_exacteEvaluated = chkCourbeF0ExacteEvaluated.IsChecked.Value, F0_stableEvaluated = chkF0StableEvaluated.IsChecked.Value, Intensite_stableEvaluated = chkIntensiteStableEvaluated.IsChecked.Value, Duree_exacteEvaluated = chkDurationEvaluated.IsChecked.Value, Duree_exacte = duree, JitterEvaluated = chkJitterEvaluated.IsChecked.Value, F0_exact_good_max = decimal.Parse(txtF0ExactGoodMax.Text), F0_exact_good_min = decimal.Parse(txtF0ExactGoodMin.Text), F0_exact_okay_max = decimal.Parse(txtF0ExactOkayMax.Text), F0_exact_okay_min = decimal.Parse(txtF0ExactOkayMin.Text), F0_exact_bad_max = decimal.Parse(txtF0ExactBadMax.Text), F0_exact_bad_min = decimal.Parse(txtF0ExactBadMin.Text), F0_stable_good_max = decimal.Parse(txtF0StableGoodMax.Text), F0_stable_good_min = decimal.Parse(txtF0StableGoodMin.Text), F0_stable_okay_max = decimal.Parse(txtF0StableOkayMax.Text), F0_stable_okay_min = decimal.Parse(txtF0StableOkayMin.Text), F0_stable_bad_max = decimal.Parse(txtF0StableBadMax.Text), F0_stable_bad_min = decimal.Parse(txtF0StableBadMin.Text), Intensite_stable_good_max = decimal.Parse(txtIntensiteStableGoodMax.Text), Intensite_stable_good_min = decimal.Parse(txtIntensiteStableGoodMin.Text), Intensite_stable_okay_max = decimal.Parse(txtIntensiteStableOkayMax.Text), Intensite_stable_okay_min = decimal.Parse(txtIntensiteStableOkayMin.Text), Intensite_stable_bad_max = decimal.Parse(txtIntensiteStableBadMax.Text), Intensite_stable_bad_min = decimal.Parse(txtIntensiteStableBadMin.Text), Courbe_F0_exact_good_max = decimal.Parse(txtCourbeF0ExactGoodMax.Text), Courbe_F0_exact_good_min = decimal.Parse(txtCourbeF0ExactGoodMin.Text), Courbe_F0_exact_okay_max = decimal.Parse(txtCourbeF0ExactOkayMax.Text), Courbe_F0_exact_okay_min = decimal.Parse(txtCourbeF0ExactOkayMin.Text), Courbe_F0_exact_bad_max = decimal.Parse(txtCourbeF0ExactBadMax.Text), Courbe_F0_exact_bad_min = decimal.Parse(txtCourbeF0ExactBadMin.Text), Duree_good_max = decimal.Parse(txtDurationGoodMax.Text), Duree_good_min = decimal.Parse(txtDurationGoodMin.Text), Duree_okay_max = decimal.Parse(txtDurationOkayMax.Text), Duree_okay_min = decimal.Parse(txtDurationOkayMin.Text), Duree_bad_max = decimal.Parse(txtDurationBadMax.Text), Duree_bad_min = decimal.Parse(txtDurationBadMin.Text), Jitter_good_max = decimal.Parse(txtJitterGoodMax.Text), Jitter_good_min = decimal.Parse(txtJitterGoodMin.Text), Jitter_okay_max = decimal.Parse(txtJitterOkayMax.Text), Jitter_okay_min = decimal.Parse(txtJitterOkayMin.Text), Jitter_bad_max = decimal.Parse(txtJitterBadMax.Text), Jitter_bad_min = decimal.Parse(txtJitterBadMin.Text) }; var configFile = new XmlHelper(false); configFile.ImportNode(configFile.GetRoot(), XmlHelper.MakeActivityNode(activityVM)); configFile.Save(targetXMLPath); ImportExistingExercices(); ActivityListInstance.SetDefaultExerciceValues(); DataContext = null; DataContext = ActivityListInstance; }
public void ReadAllExercicesIntoExerciceVMList(string filePath, ObservableCollection <ExerciceVM> list) { foreach (string file in Directory.GetFiles(filePath)) { if (Path.GetExtension(file) == ".xml") { XDocument xml = XDocument.Load(file); var exercice = xml.Descendants("Activity"); var isMyotype = exercice.Count();//Vérifie si le .xml est un exercice MyOrtho if (isMyotype > 0) { ExerciceVM newExercice = new ExerciceVM { Name = exercice.Descendants("Name").First().Value, Example_wav_path = exercice.Descendants("Exercice_wav_file_name").First().Value, PitchMin = int.Parse(exercice.Descendants("Pitch_min").First().Value), PitchMax = int.Parse(exercice.Descendants("Pitch_max").First().Value), IntensityThreshold = int.Parse(exercice.Descendants("Intensity_threshold").First().Value), Duree_exacte = int.Parse(exercice.Descendants("Duree_exacte").First().Value), F0_exactEvaluated = exercice.Descendants("F0_exactEvaluated").First().Value == "True"?true : false, F0_stableEvaluated = exercice.Descendants("F0_stableEvaluated").First().Value == "True" ? true : false, Courbe_f0_exacteEvaluated = exercice.Descendants("Courbe_f0_exacteEvaluated").First().Value == "True" ? true : false, Intensite_stableEvaluated = exercice.Descendants("Intensite_stableEvaluated").First().Value == "True" ? true : false, Duree_exacteEvaluated = exercice.Descendants("Duree_exacteEvaluated").First().Value == "True" ? true : false, JitterEvaluated = exercice.Descendants("JitterEvaluated").First().Value == "True" ? true : false, F0_exact_good_max = decimal.Parse(exercice.Descendants("F0_exacte_evaluation").First().Descendants("Good").Descendants("Max").First().Value), F0_exact_good_min = decimal.Parse(exercice.Descendants("F0_exacte_evaluation").First().Descendants("Good").Descendants("Min").First().Value), F0_exact_okay_max = decimal.Parse(exercice.Descendants("F0_exacte_evaluation").First().Descendants("Okay").Descendants("Max").First().Value), F0_exact_okay_min = decimal.Parse(exercice.Descendants("F0_exacte_evaluation").First().Descendants("Okay").Descendants("Min").First().Value), F0_exact_bad_max = decimal.Parse(exercice.Descendants("F0_exacte_evaluation").First().Descendants("Bad").Descendants("Max").First().Value), F0_exact_bad_min = decimal.Parse(exercice.Descendants("F0_exacte_evaluation").First().Descendants("Bad").Descendants("Min").First().Value), F0_stable_good_max = decimal.Parse(exercice.Descendants("F0_stable_evaluation").First().Descendants("Good").Descendants("Max").First().Value), F0_stable_good_min = decimal.Parse(exercice.Descendants("F0_stable_evaluation").First().Descendants("Good").Descendants("Min").First().Value), F0_stable_okay_max = decimal.Parse(exercice.Descendants("F0_stable_evaluation").First().Descendants("Okay").Descendants("Max").First().Value), F0_stable_okay_min = decimal.Parse(exercice.Descendants("F0_stable_evaluation").First().Descendants("Okay").Descendants("Min").First().Value), F0_stable_bad_max = decimal.Parse(exercice.Descendants("F0_stable_evaluation").First().Descendants("Bad").Descendants("Max").First().Value), F0_stable_bad_min = decimal.Parse(exercice.Descendants("F0_stable_evaluation").First().Descendants("Bad").Descendants("Min").First().Value), Courbe_F0_exact_good_max = decimal.Parse(exercice.Descendants("Courbe_F0_exacte_evaluation").First().Descendants("Good").Descendants("Max").First().Value), Courbe_F0_exact_good_min = decimal.Parse(exercice.Descendants("Courbe_F0_exacte_evaluation").First().Descendants("Good").Descendants("Min").First().Value), Courbe_F0_exact_okay_max = decimal.Parse(exercice.Descendants("Courbe_F0_exacte_evaluation").First().Descendants("Okay").Descendants("Max").First().Value), Courbe_F0_exact_okay_min = decimal.Parse(exercice.Descendants("Courbe_F0_exacte_evaluation").First().Descendants("Okay").Descendants("Min").First().Value), Courbe_F0_exact_bad_max = decimal.Parse(exercice.Descendants("Courbe_F0_exacte_evaluation").First().Descendants("Bad").Descendants("Max").First().Value), Courbe_F0_exact_bad_min = decimal.Parse(exercice.Descendants("Courbe_F0_exacte_evaluation").First().Descendants("Bad").Descendants("Min").First().Value), Intensite_stable_good_max = decimal.Parse(exercice.Descendants("Intensite_stable_evaluation").First().Descendants("Good").Descendants("Max").First().Value), Intensite_stable_good_min = decimal.Parse(exercice.Descendants("Intensite_stable_evaluation").First().Descendants("Good").Descendants("Min").First().Value), Intensite_stable_okay_max = decimal.Parse(exercice.Descendants("Intensite_stable_evaluation").First().Descendants("Okay").Descendants("Max").First().Value), Intensite_stable_okay_min = decimal.Parse(exercice.Descendants("Intensite_stable_evaluation").First().Descendants("Okay").Descendants("Min").First().Value), Intensite_stable_bad_max = decimal.Parse(exercice.Descendants("Intensite_stable_evaluation").First().Descendants("Bad").Descendants("Max").First().Value), Intensite_stable_bad_min = decimal.Parse(exercice.Descendants("Intensite_stable_evaluation").First().Descendants("Bad").Descendants("Min").First().Value), Jitter_good_max = decimal.Parse(exercice.Descendants("Jitter_evaluation").First().Descendants("Good").Descendants("Max").First().Value), Jitter_good_min = decimal.Parse(exercice.Descendants("Jitter_evaluation").First().Descendants("Good").Descendants("Min").First().Value), Jitter_okay_max = decimal.Parse(exercice.Descendants("Jitter_evaluation").First().Descendants("Okay").Descendants("Max").First().Value), Jitter_okay_min = decimal.Parse(exercice.Descendants("Jitter_evaluation").First().Descendants("Okay").Descendants("Min").First().Value), Jitter_bad_max = decimal.Parse(exercice.Descendants("Jitter_evaluation").First().Descendants("Bad").Descendants("Max").First().Value), Jitter_bad_min = decimal.Parse(exercice.Descendants("Jitter_evaluation").First().Descendants("Bad").Descendants("Min").First().Value), Duree_good_max = decimal.Parse(exercice.Descendants("Duree_exacte_evaluation").First().Descendants("Good").Descendants("Max").First().Value), Duree_good_min = decimal.Parse(exercice.Descendants("Duree_exacte_evaluation").First().Descendants("Good").Descendants("Min").First().Value), Duree_okay_max = decimal.Parse(exercice.Descendants("Duree_exacte_evaluation").First().Descendants("Okay").Descendants("Max").First().Value), Duree_okay_min = decimal.Parse(exercice.Descendants("Duree_exacte_evaluation").First().Descendants("Okay").Descendants("Min").First().Value), Duree_bad_max = decimal.Parse(exercice.Descendants("Duree_exacte_evaluation").First().Descendants("Bad").Descendants("Max").First().Value), Duree_bad_min = decimal.Parse(exercice.Descendants("Duree_exacte_evaluation").First().Descendants("Bad").Descendants("Min").First().Value), }; newExercice.Exercice = exercice.Descendants("Exercice_praat_results").First().Descendants("point").Select(x => new DataLineItem { Time = double.Parse(x.Descendants("time").First().Value), Pitch = double.Parse(x.Descendants("pitch").First().Value), Intensity = double.Parse(x.Descendants("frequency").First().Value) }).ToList(); list.Add(newExercice); } } } }
private void updateDataGrid(ExerciceVM selectedExercise) { activityListInstance.ClearEvaluated(); activityListInstance.AddEvaluated(new ExerciseEvaluationGridRow { Name = "F0 exact", Evaluated = selectedExercise.F0_exactEvaluated.ToString(), GoodMax = selectedExercise.F0_exact_good_max.ToString(), GoodMin = selectedExercise.F0_exact_good_min.ToString(), OkayMax = selectedExercise.F0_exact_okay_max.ToString(), OkayMin = selectedExercise.F0_exact_okay_min.ToString(), BadMax = selectedExercise.F0_exact_bad_max.ToString(), BadMin = selectedExercise.F0_exact_bad_min.ToString() }); activityListInstance.AddEvaluated(new ExerciseEvaluationGridRow { Name = "F0 stable", Evaluated = selectedExercise.F0_stableEvaluated.ToString(), GoodMax = selectedExercise.F0_stable_good_max.ToString(), GoodMin = selectedExercise.F0_stable_good_min.ToString(), OkayMax = selectedExercise.F0_stable_okay_max.ToString(), OkayMin = selectedExercise.F0_stable_okay_min.ToString(), BadMax = selectedExercise.F0_stable_bad_max.ToString(), BadMin = selectedExercise.F0_stable_bad_min.ToString() }); activityListInstance.AddEvaluated(new ExerciseEvaluationGridRow { Name = "Courbe F0 exact", Evaluated = selectedExercise.Courbe_f0_exacteEvaluated.ToString(), GoodMax = selectedExercise.Courbe_F0_exact_good_max.ToString(), GoodMin = selectedExercise.Courbe_F0_exact_good_min.ToString(), OkayMax = selectedExercise.Courbe_F0_exact_okay_max.ToString(), OkayMin = selectedExercise.Courbe_F0_exact_okay_min.ToString(), BadMax = selectedExercise.Courbe_F0_exact_bad_max.ToString(), BadMin = selectedExercise.Courbe_F0_exact_bad_min.ToString() }); activityListInstance.AddEvaluated(new ExerciseEvaluationGridRow { Name = "Intensité stable", Evaluated = selectedExercise.Intensite_stableEvaluated.ToString(), GoodMax = selectedExercise.Intensite_stable_good_max.ToString(), GoodMin = selectedExercise.Intensite_stable_good_min.ToString(), OkayMax = selectedExercise.Intensite_stable_okay_max.ToString(), OkayMin = selectedExercise.Intensite_stable_okay_min.ToString(), BadMax = selectedExercise.Intensite_stable_bad_max.ToString(), BadMin = selectedExercise.Intensite_stable_bad_min.ToString() }); activityListInstance.AddEvaluated(new ExerciseEvaluationGridRow { Name = "Durée exacte", Evaluated = selectedExercise.Duree_exacteEvaluated.ToString(), GoodMax = selectedExercise.Duree_good_max.ToString(), GoodMin = selectedExercise.Duree_good_min.ToString(), OkayMax = selectedExercise.Duree_okay_max.ToString(), OkayMin = selectedExercise.Duree_okay_min.ToString(), BadMax = selectedExercise.Duree_bad_max.ToString(), BadMin = selectedExercise.Duree_bad_min.ToString() }); activityListInstance.AddEvaluated(new ExerciseEvaluationGridRow { Name = "Jitter", Evaluated = selectedExercise.JitterEvaluated.ToString(), GoodMax = selectedExercise.Jitter_good_max.ToString(), GoodMin = selectedExercise.Jitter_good_min.ToString(), OkayMax = selectedExercise.Jitter_okay_max.ToString(), OkayMin = selectedExercise.Jitter_okay_min.ToString(), BadMax = selectedExercise.Jitter_bad_max.ToString(), BadMin = selectedExercise.Jitter_bad_min.ToString() }); //evaluatedDataGrid.ItemsSource = listOfEvaluatedParameters; }