public SendMessage() { InitializeComponent(); Thread.Sleep(2000); sound.play("confirm"); this.commentLocation = (Application.Current as App).commentAndLocationShared; this.myMicrophone = (Application.Current as App).myMicrophoneShare; Thread.Sleep(500); LayoutRoot.DoubleTap += DoubleTap; }
private void map_HoldMoq(object sender, System.Windows.Input.GestureEventArgs e) { /* Record the microphone */ if (myMicrophone.microphone.State == MicrophoneState.Stopped) { myMicrophone.initializeMicrophone(); myMicrophone.streamMicrophone = new MemoryStream(); myMicrophone.microphone.BufferDuration = TimeSpan.FromMilliseconds(1000); myMicrophone.bufferMicrophone = new byte[myMicrophone.microphone.GetSampleSizeInBytes(myMicrophone.microphone.BufferDuration)]; sound.play("recording"); Thread.Sleep(1000); myMicrophone.microphone.Start(); } /* Stop the record */ else if (myMicrophone.microphone.State == MicrophoneState.Started) { myMicrophone.microphone.Stop(); CommentAndLocation commentAndLocation = new CommentAndLocation(globalPositionSystemForMap, baseWebserver); sound.play("recordingend"); //if (myMicrophone.streamMicrophone.Length != 0) SpeechService.RecognizeSpeechAsync(HawaiiClient.HawaiiApplicationId, SpeechService.DefaultGrammar , myMicrophone.streamMicrophone.ToArray(), onCompletedSpeechRecognition); if (myMicrophone.streamMicrophone.Length != 0) { (Application.Current as App).commentAndLocationShared = commentAndLocation; (Application.Current as App).myMicrophoneShare = myMicrophone; NavigationService.Navigate(new Uri("/SendMessage.xaml", UriKind.Relative)); } myMicrophone.removeMicrophone(); } }