public ExerciseSelector() { InitializeComponent(); #if AUDIOUI registerSpeechCommands(); #endif Exercise[] exercises = ExerciseFactory.GetExercises(); for (int i = 0; i < exercises.Length; i++) { #if AUDIOUI Uri source = new Uri("Images/Voice.bmp", UriKind.Relative); LabelAndImage labelImage = new LabelAndImage(new BitmapImage(source), SharedContent.GetCommandString(exercises[i].name), System.Windows.HorizontalAlignment.Left, (double)Application.Current.Resources["BigButtonHeight"], (double)Application.Current.Resources["BigButtonWidth"], (double)Application.Current.Resources["BigButtonFont"]); buttonPanel.Children.Add(labelImage); #elif BUTTONUI Button button = new Button(); button.Content = SharedContent.GetCommandString(exercises[i].name); button.Height = (double)Application.Current.Resources["BigButtonHeight"]; button.Width = (double)Application.Current.Resources["BigButtonWidth"]; button.FontSize = (double)Application.Current.Resources["BigButtonFont"]; button.Click += selectedExercise; button.Tag = i; buttonPanel.Children.Add(button); #endif } }
public ExerciseFeedback(Exercise ex) { InitializeComponent(); stepViewer.Height = (double)Application.Current.Resources["AppHeight"] - (double)Application.Current.Resources["BigButtonHeight"]; #if AUDIOUI SharedContent.Sr.registerSpeechCommand(SharedContent.Commands.Back, selectedResponse); SharedContent.Sr.registerSpeechCommand(SharedContent.Commands.Retry, selectedResponse); #endif this.ex = ex; ExerciseStep[] steps = ex.exerciseSteps; foreach (ExerciseStep step in steps) { Uri source; switch (step.stepStatus) { case ExerciseStepStatus.Complete: source = new Uri("Images/CheckboxPass.bmp", UriKind.Relative); break; case ExerciseStepStatus.Failed: source = new Uri("Images/CheckboxFail.bmp", UriKind.Relative); break; default: source = new Uri("Images/Checkbox.bmp", UriKind.Relative); break; } LabelAndImage lai = new LabelAndImage(new BitmapImage(source), step.stepName, HorizontalAlignment.Left, (double)Application.Current.Resources["SmallButtonHeight"], (double)Application.Current.Resources["BigButtonWidth"], (double)Application.Current.Resources["SmallButtonFont"]); stepPanel.Children.Add(lai); } switch (ex.exerciseStatus) { case ExerciseStatus.Complete: statusLabel.Content = "COMPLETE!"; break; case ExerciseStatus.Failed: statusLabel.Content = "FAIL"; break; } }