private void DoPlaySoundEffect(PlaySoundEffectMessage message)
 {
     if (SoundName == message.SoundName)
     {
         Dispatcher.BeginInvoke(() =>
         {
             using (var stream = TitleContainer.OpenStream(SoundFileLocation))
             {
                 if (stream != null)
                 {
                     var effect = SoundEffect.FromStream(stream);
                     FrameworkDispatcher.Update();
                     effect.Play();
                 }
             }
         });
     }
 }
示例#2
0
 private void DoPlaySoundFile(PlaySoundEffectMessage message)
 {
     if (SoundName == message.SoundName)
     {
         if (message.Start)
         {
             if (Repeat)
             {
                 doRepeat = true;
             }
             AssociatedObject.Position = TimeSpan.FromSeconds(0);
             AssociatedObject.Play();
         }
         else
         {
             doRepeat = false;
         }
     }
 }