using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;

namespace WPMediaPlayerLauncher
{
    public partial class MainPage : PhoneApplicationPage
    {
        // Constructor
        public MainPage()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, RoutedEventArgs e)
        {
            //Neue MediaPlayer Instanz anlegen
            Microsoft.Phone.Tasks.MediaPlayerLauncher myMediaPlayer = new Microsoft.Phone.Tasks.MediaPlayerLauncher();
            //Steuerelemente des Media Players definieren
            myMediaPlayer.Controls = Microsoft.Phone.Tasks.MediaPlaybackControls.All;
            //Speicherort der Medien bestimmen
            myMediaPlayer.Location = Microsoft.Phone.Tasks.MediaLocationType.Install;
            //Abzuspielendes Medium auswählen
            myMediaPlayer.Media = new System.Uri("Media\\Lieblingslied.mp3", System.UriKind.Relative);
            //Alternativ auch als Stream aus dem Internet
            //myMediaPlayer.Media = new System.Uri("http://ecn.channel9.msdn.com/o9/ch9/8126/568126/20Games_ch9.wmv");
            //Media Player starten
            myMediaPlayer.Show();
        }
    }
}
