// Invoke the Completion event; calle whenever the catalog creation has completed. protected virtual void OnCatalogComplete(CatalogCompleteEventArg e) { if (CatalogCompleteEventHandler != null) { CatalogCompleteEventHandler(this, e); } }
/// <summary> /// This will generate the Exercise objects which will be overlayed on the default Exercises loaded in the ExerciseQueue /// Used by the OnCatalogComplete event /// </summary> /// <returns></returns> public CatalogCompleteEventArg GetCurrentWorkout() { Exercise[] exerciseList = _workoutList.ToArray(); CatalogCompleteEventArg eventArgs = new CatalogCompleteEventArg(exerciseList); return(eventArgs); }
/// <summary> /// When the catalog notifies that the Exercises have been loaded and the patient is ready to exercise, /// The exercise queue will load up the exercises pushed into the CurrentCatalog. /// /// </summary> /// <returns></returns> public void LoadExercises(object sender, CatalogCompleteEventArg e) { ReInitialize(); OnLoadStarted(EventArgs.Empty); string path = System.AppDomain.CurrentDomain.BaseDirectory + "../../../../KinectTherapyContent/Exercises/"; Exercises = new ExerciseGameComponent[e.Exercises.Length]; //loop through the exercises in the CurrentCatalog and turn them into Exercise objects. for (int i = 0; i < e.Exercises.Length; i++) { XmlSerializer serializer = new XmlSerializer(typeof(Exercise)); StreamReader reader = new StreamReader(path + e.Exercises[i].Id + ".xml"); // deserialize the xml and create an Exercise Exercise temp = (Exercise)serializer.Deserialize(reader); temp.Repetitions = e.Exercises[i].Repetitions; temp.Variance = e.Exercises[i].Variance; Exercises[i] = new ExerciseGameComponent(_game, temp); reader.Close(); //Queue up for a workout PendingExercises.Enqueue(Exercises[i]); } // once they're all queued start the first exercise. NextExercise(); OnLoadComplete(EventArgs.Empty); }
/// <summary> /// This will generate the Exercise objects which will be overlayed on the default Exercises loaded in the ExerciseQueue /// Used by the OnCatalogComplete event /// </summary> /// <returns></returns> public CatalogCompleteEventArg GetCurrentWorkout() { Exercise[] exerciseList = _workoutList.ToArray(); CatalogCompleteEventArg eventArgs = new CatalogCompleteEventArg(exerciseList); return eventArgs; }