private void searchCallback(RestRequest request, RestResponse response, object sender) { XmlReader rdr = XmlReader.Create(response.ContentStream); while (!rdr.EOF) { if (rdr.ReadToFollowing("exercise")) { SearchedExercise exercise = new SearchedExercise(); rdr.ReadToFollowing("id"); exercise.id = rdr.ReadElementContentAsInt(); rdr.ReadToFollowing("name"); exercise.Name = rdr.ReadElementContentAsString(); rdr.ReadToFollowing("exercise-description"); exercise.Description = rdr.ReadElementContentAsString(); rdr.ReadToFollowing("exercise-type"); exercise.exercise_type = rdr.ReadElementContentAsString(); rdr.ReadToFollowing("exercise-video-url"); exercise.exercise_video_url = rdr.ReadElementContentAsString(); rdr.ReadToFollowing("exercise-picture-url"); exercise.PictureUrl = rdr.ReadElementContentAsString(); rdr.ReadToFollowing("exercise-order"); if (!rdr.MoveToAttribute("nil")) exercise.exercise_order = rdr.ReadElementContentAsInt(); else exercise.exercise_order = 0; exercises.Add(exercise); } } OnSearchComplete(); }
public cardioRecord(SearchedExercise Exercise) { InitializeComponent(); exercise = Exercise; }