Note that there are some explanatory texts on larger screens.

plurals
  1. PONeed Small Help On Windows Phone 7
    primarykey
    data
    text
    <p>I m creating an app.. I m facing a small problem. I want to get this thing... I have a radio button. Now i want to play a small music in loop whenever this radio button is clicked. I am using visual studio.. Cannot use expression for it. I am using the following code..</p> <pre><code>public partial class Page3 : PhoneApplicationPage { private SoundEffect s1; public Page3() { InitializeComponent(); GameTimer gameTimer = new GameTimer(); gameTimer.UpdateInterval = TimeSpan.FromMilliseconds(10000); // Call FrameworkDispatcher.Update to update the XNA Framework internals. gameTimer.Update += delegate { try { FrameworkDispatcher.Update(); } catch { } }; // Start the GameTimer running. gameTimer.Start(); // Prime the pump or we'll get an exception. FrameworkDispatcher.Update(); LoadSound("Views/1.wav", out s1); } private void LoadSound(String SoundFilePath, out SoundEffect Sound) { // For error checking, assume we'll fail to load the file. Sound = null; try { // Holds informations about a file stream. StreamResourceInfo SoundFileInfo = App.GetResourceStream(new Uri(SoundFilePath, UriKind.Relative)); // Create the SoundEffect from the Stream Sound = SoundEffect.FromStream(SoundFileInfo.Stream); } catch (NullReferenceException) { // Display an error message MessageBox.Show("Couldn't load sound " + SoundFilePath); } } private void radioButton1_Checked(object sender, RoutedEventArgs e) { try { s1.Play(); } catch (NullReferenceException) { MessageBox.Show("Can't play, s1 is null."); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload