title: Iterate through the enumeration and check the state of the MediaPlayer before advancing to the next song
body: <p>I need to play songs in my IEnumerable collection, but there is so many problem with this method. If I use timer to check the MediaState, it may works, however when I navigate from this page, the class will be cancel and the music will be stopped. The reason I want to do this is to be able to play song from different albums:</p>
  
  <p>My code:</p>
  
  <pre><code>    private SongCollection mySongCollection;
      IEnumerable&lt;Song&gt; ultimateCollection;
  
      mySongCollection = library.Albums[index].Songs;
      ultimateCollection = mySongCollection.Concat(library.Albums[1].Songs);
  
      foreach (Song a in ultimateCollection)
        {
        while (MediaPlayer.State == MediaState.Playing || MediaPlayer.State == MediaState.Paused)
                      {
                         //while MediaState still playing, dont play next song
                      }
                          MediaPlayer.Play(a);
         }
  </code></pre>