Click here to Skip to main content
15,884,176 members
Articles / Web Development / ASP.NET

Silverlight Media Player

Rate me:
Please Sign up or sign in to vote.
4.05/5 (13 votes)
6 Apr 2009Public Domain2 min read 92K   5.6K   45  
Has some cool features like sliding menus with animation and Drag N Drop from menu
using System;
using System.Windows;
using System.Windows.Controls;
using System.Xml.Linq;
using System.Linq;
using System.Collections.Generic;
using System.Windows.Media.Imaging;

namespace MediaPlayer
{
    public class DataAcces
    {
        public static void SetRightVertPanel(StackPanel elem)
        {
            XDocument xDoc = XDocument.Load("Data.xml");
            var xVids = from v in xDoc.Descendants("Video")   
                        where v.Attribute("img").Value.Length>0 && v.Attribute("vid").Value.Length>0
                        select new
                        {
                            img = v.Attribute("img").Value,
                            vid = v.Attribute("vid").Value,
                            id = v.Attribute("id").Value
                        };
            elem.Children.Clear();           
            foreach (var v in xVids)
            {
                Image img = new Image();
                img.Source = new BitmapImage(new Uri(v.img, UriKind.Relative));                
                img.Margin = new Thickness(1, 4, 1, 0);
                img.Width = 50;
                elem.Children.Add(img);  
            }     
        }
        public static string GetVideoName(string imgPara)
        {
            XDocument xDoc = XDocument.Load("Data.xml");
            var xVids = from v in xDoc.Descendants("Video")
                        where v.Attribute("img").Value.Equals(imgPara) 
                        select new
                        {
                            img = v.Attribute("img").Value,
                            vid = v.Attribute("vid").Value,
                            id = v.Attribute("id").Value
                        };
            if (xVids.Count() > 0)
            {
                return xVids.First().vid;
            }
            else
                return "";
        }
    }
}

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 A Public Domain dedication


Written By
Software Developer (Senior) Geometric
India India
B.E. in Information Technology
MCTS(.NET 2.0 )

Comments and Discussions