private void OnGestureRecognized(object sender, GestureRecognizedEventArgs e)
        {
            if (SlideShowCommandDetected != null)
            {
                SlideShowCommandDetectedEventArgs args = null;

                switch (e.Result.GestureSubType)
                {
                    case GESTURE_COMMAND_NEXT:
                        args = new SlideShowCommandDetectedEventArgs(SlideShowCommandType.Next);
                        break;
                    case GESTURE_COMMAND_PREVIOUS:
                        args = new SlideShowCommandDetectedEventArgs(SlideShowCommandType.Previous);
                        break;
                }

                SlideShowCommandDetected(this, args);
            }
        }
 private void OnSlideShowCommandDetected(object sender, SlideShowCommandDetectedEventArgs e)
 {
     switch(e.EventType)
     {
         case SlideShowCommandType.Next:
             slideShowView.Next();
             break;
         case SlideShowCommandType.Previous:
             slideShowView.Previous();
             break;
         case SlideShowCommandType.GotoSlide:
             slideShowView.GotoSlide(e.SlideIndex);
             break;
         case SlideShowCommandType.EndSlideShow:
             slideShowView.Exit();
             break;
         case SlideShowCommandType.Cue:
             slideShowView.Next();
             step++;
             break;
     }
 }
        private void OnSpeechRecognized(object sender, SpeechRecognizedEventArgs e)
        {
            if (SlideShowCommandDetected != null)
            {
                SlideShowCommandDetectedEventArgs args = null;

                if (e.Result.Text.StartsWith(SPEECH_COMMAND_PREFIX))
                {
                    string command = e.Result.Text.Substring(SPEECH_COMMAND_PREFIX.Length + 1);

                    if(command.StartsWith(SPEECH_COMMAND_GOTO_SLIDE))
                    {
                        int slideIndex = int.Parse(command.Substring(SPEECH_COMMAND_GOTO_SLIDE.Length + 1));
                        args = new SlideShowCommandDetectedEventArgs(SlideShowCommandType.GotoSlide, slideIndex);
                    }
                    else
                    {
                        switch(command)
                        {
                            case SPEECH_COMMAND_NEXT:
                                args = new SlideShowCommandDetectedEventArgs(SlideShowCommandType.Next);
                                break;
                            case SPEECH_COMMAND_PREVIOUS:
                                args = new SlideShowCommandDetectedEventArgs(SlideShowCommandType.Previous);
                                break;
                            case SPEECH_COMMAND_END_SLIDESHOW:
                                args = new SlideShowCommandDetectedEventArgs(SlideShowCommandType.EndSlideShow);
                                break;
                            default:
                                // a cue word that starts with "powerpoint"?
                                args = new SlideShowCommandDetectedEventArgs(SlideShowCommandType.Cue, command);
                                break;
                        }
                    }
                }
                else
                {
                    args = new SlideShowCommandDetectedEventArgs(SlideShowCommandType.Cue, e.Result.Text);
                }

                if (args.EventType == SlideShowCommandType.Cue && !IsCurrentCue(args.Cue))
                {
                    return;
                }

                SlideShowCommandDetected(this, args);
            }
        }