Click here to Skip to main content
15,896,111 members
Articles / Desktop Programming / WPF

Music Video Box (WPF)

Rate me:
Please Sign up or sign in to vote.
4.00/5 (4 votes)
10 Aug 2009CPOL3 min read 39.2K   1.8K   24  
This article explains the creation of a Music Video Box using Windows Presentation Foundation 3D Geometry and Media classes to play music albums as chosen by the user.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace MusicVideoBox
{
    /// <summary>
    /// Interaction logic for MusicPlayer.xaml
    /// </summary>
    public partial class MusicPlayer : Window
    {
        public string currentAlbum;
        public string currentTrackPath;
        public MusicPlayer()
        {
            InitializeComponent();
        }

        private void MusicPlayer_Loaded(object sender, RoutedEventArgs e)
        {
            StatusLabel.Content = this.currentAlbum + ":  " + (this.currentTrackPath.Split(new string[1] { @"\" }, 6, StringSplitOptions.None))[5];
            StatusLabel.Content += "\nComplete video tracks are not shipped along with this software.";
          myMediaElement.Source = new Uri(this.currentTrackPath.ToString());
          myMediaElement.Play();
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Founder BB Systems CIT-GPNP
India India
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions