Exemple #1
0
        private void MediaPropertiesMenuItem_Click(object sender, RoutedEventArgs e)
        {
            // display the music and video elements properties
            String      location = dlg.FileName.ToString();
            MusicID3Tag musicTag = new MusicID3Tag(location);
            FileInfo    fileInfo = new FileInfo(location);

            long f = fileInfo.Length;

            TimeSpan ts = videoMediaElement.NaturalDuration.TimeSpan;

            // Title, Location, FileSize, Length,

            // if mp3 file is currently playing show properties of file
            if (dlg.FileName.Substring(dlg.FileName.Length - 3) == "mp3")
            {
                MessageBox.Show(musicTag.GetMP3Info());
            }

            // if video is present show properties of video
            else
            {
                MessageBox.Show("Title: " + fileInfo.Name + "\n" + "Location: " + location + "\n" + "File Size: " + f + "\n" + "Length:" + String.Format("{0:00}:{1:00}:{2:00}",

                                                                                                                                                         ts.Hours, ts.Minutes, ts.Seconds) + System.Environment.NewLine);
            }
        }