daily pastebin goal
33%
SHARE
TWEET

Untitled

a guest Jan 20th, 2018 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2. using System.Media;
  3. using System.Windows;
  4. using System.Windows.Resources;
  5.  
  6. namespace SoundTest
  7. {
  8.     /// <summary>
  9.     /// Interaction logic for MainWindow.xaml
  10.     /// </summary>
  11.     public partial class MainWindow : Window
  12.     {
  13.         public MainWindow()
  14.         {
  15.             InitializeComponent();
  16.         }
  17.  
  18.         private void Button_Click(object sender, RoutedEventArgs e)
  19.         {
  20.             string assembly = System.Reflection.Assembly.GetExecutingAssembly().GetName().Name;
  21.             Uri uri = new Uri(assembly + @";component/01 Gravity.wav", UriKind.Relative);
  22.             StreamResourceInfo resourceStream = Application.GetResourceStream(uri);
  23.             SoundPlayer player = new SoundPlayer(resourceStream.Stream);
  24.             player.Play();
  25.         }
  26.     }
  27. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top