private void AtomPlayer_MediaEnded(object sender, RoutedEventArgs e)
 {
     if (repeatIndefinitely)
     {
         AtomPlayer.Position = TimeSpan.FromSeconds(0);
         AtomPlayer.Play();
     }
 }
        private void BrowseButtonClick(object sender, RoutedEventArgs e)

        {
            OpenFileDialog dlg = new OpenFileDialog();

            dlg.Filter           = "Media Files (*.wmv;*.mp4;*.mp3;*.wav;*.avi;*.mkv)|*.wmv;*.mp4;*.mp3;*.wav;*.avi;*.mkv|All Files (*.*)|*.*";
            dlg.RestoreDirectory = true;
            dlg.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);


            if (dlg.ShowDialog() == true)
            {
                string selectedFileName = dlg.FileName;
                AtomPlayer.Source = new Uri(selectedFileName);
                AtomPlayer.Play();
                loopTimer.Start();
                this.Title = Path.GetFileNameWithoutExtension(selectedFileName);
            }
        }
 private void btnPlay_Click(object sender, RoutedEventArgs e)
 {
     AtomPlayer.Play();
 }