private void PlayMessage_Completed(object sender, OpenReadCompletedEventArgs e) { try { if (e.Error != null) { MessageBox.Show(e.Error.Message); MessagePlayCleanup(e.Error.Message); } else if (e.Result.Length < 200) { // fix: Try to parse XML and see what the error was? MessageBox.Show("Could not find message"); MessagePlayCleanup("Message Play Failed"); } else if (e.Result.Length < 20000) { MessagePlayCleanup("Message Too Short"); } else { Message msg = (Message)e.UserState; ShowProgress(true, "Playing Message..."); setButtonContent(false); pbPlaying.Value = 0; pbPlaying.Maximum = msg.Length; pbPlaying.IsEnabled = true; pbPlaying.Visibility = Visibility.Visible; MemoryStream data = new MemoryStream(); PushData(e.Result, data); SoundEffect sound = new SoundEffect(data.ToArray(), microphone.SampleRate, AudioChannels.Mono); soundInstance = sound.CreateInstance(); soundInstance.Play(); soundStartTime = DateTime.Now; soundIsPlaying = true; data.Dispose();
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)