/* * this method will handle navigation based on voice command by accepting a * string parameter containing one of the six choices and porcessing it through * a switch case block. Each case will add its respective page to the children of * the kinectregiongrid and navigate the user to their desired page. */ public void VoiceNavigation(String pageToNavTo) { switch (pageToNavTo) { case "for loop": ForLoop ForLoopPage = new ForLoop(); this.kinectRegionGrid.Children.Add(ForLoopPage); break; case "if statement": IfStatement ifStatementPage = new IfStatement(); this.kinectRegionGrid.Children.Add(ifStatementPage); break; case "do while": WhileLoop whileLoopPage = new WhileLoop(); this.kinectRegionGrid.Children.Add(whileLoopPage); break; case "hello world": HelloWorld helloWorldPage = new HelloWorld(); this.kinectRegionGrid.Children.Add(helloWorldPage); break; case "methods": Methods methodsPage = new Methods(); this.kinectRegionGrid.Children.Add(methodsPage); break; case "fizz buzz": FizzBuzz fizzBuzzPage = new FizzBuzz(); this.kinectRegionGrid.Children.Add(fizzBuzzPage); break; case "fizzbuzz": FizzBuzz fizzBuzzPage2 = new FizzBuzz(); this.kinectRegionGrid.Children.Add(fizzBuzzPage2); break; } }
/* * this method performs the same functionality as the VoiceNavigation method * however it will take the source of the button click as a parameter * using the button label to distinguish between cases in the switch case block. */ private void KinectTileButtonClick(object sender, RoutedEventArgs e) { var button = (KinectTileButton)e.OriginalSource; string selection = button.Label as string; switch (selection) { case "For Loop": ForLoop ForLoopPage = new ForLoop(); this.kinectRegionGrid.Children.Add(ForLoopPage); break; case "If Statement": IfStatement ifStatementPage = new IfStatement(); this.kinectRegionGrid.Children.Add(ifStatementPage); break; case "Do While": WhileLoop whileLoopPage = new WhileLoop(); this.kinectRegionGrid.Children.Add(whileLoopPage); break; case "Hello World": HelloWorld helloWorldPage = new HelloWorld(); this.kinectRegionGrid.Children.Add(helloWorldPage); break; case "Methods": Methods methodsPage = new Methods(); this.kinectRegionGrid.Children.Add(methodsPage); break; case "FizzBuzz": FizzBuzz fizzBuzzPage = new FizzBuzz(); this.kinectRegionGrid.Children.Add(fizzBuzzPage); break; } }