コード例 #1
0
        Media.Video getVideo(XmlNode node)
        {
            Media.Video video = new Media.Video();
            foreach (XmlNode item in node)
            {
                switch (item.Name)
                {
                case "id": video.Id = Convert.ToInt32(item.InnerText); break;

                case "owner_id": video.Owner_id = Convert.ToInt32(item.InnerText); break;

                case "duration": video.Duration = Convert.ToInt32(item.InnerText); break;

                case "views": video.Views = Convert.ToInt32(item.InnerText); break;

                case "date": video.Date = Convert.ToInt32(item.InnerText); break;

                case "description": video.Description = (item.OuterXml == "<description />" ? "" : item.InnerText); break;

                case "photo_130": video.Photo_130 = item.InnerText; break;

                case "photo_320": video.Photo_320 = item.InnerText; break;

                case "photo_640": video.Photo_640 = item.InnerText; break;

                case "title": video.Title = (item.OuterXml == "<title />" ? "" : item.InnerText); break;

                case "player": video.Player = item.InnerText; break;

                case "access_key": video.Access_key = item.InnerText; break;
                }
            }
            video.Player = getVideoUrl(video);
            return(video);
        }
コード例 #2
0
        private MediaViewModel()
        {
            SelectMediaCommand = new Command.SelectMediaCommand(PlayMedia);
            SelectPlaylistCommand = new Command.SelectPlaylistCommand(PlayPlaylist);
            PlayMediaCommand = new Command.PlayMediaCommand(Play);
            PauseMediaCommand = new Command.PauseMediaCommand(Pause);
            StopMediaCommand = new Command.StopMediaCommand(Stop);
            SpeedUpMediaCommand = new Command.SpeedUpMediaCommand(UpgradeSpeed);
            SpeedDownMediaCommand = new Command.SpeedDownMediaCommand(DowngradeSpeed);
            NextMediaCommand = new Command.NextMediaCommand(NextMedia);
            PrevMediaCommand = new Command.PrevMediaCommand(PrevMedia);

            CurrentMediaName = "Current Media";

            Image = new Media.Image();
            MediaElement = new Media.Video();
            Image.Display(AppDomain.CurrentDomain.BaseDirectory + "../../images/WindowsMediaPlayerLogo.png");
        }
コード例 #3
0
        private MediaViewModel()
        {
            SelectMediaCommand    = new Command.SelectMediaCommand(PlayMedia);
            SelectPlaylistCommand = new Command.SelectPlaylistCommand(PlayPlaylist);
            PlayMediaCommand      = new Command.PlayMediaCommand(Play);
            PauseMediaCommand     = new Command.PauseMediaCommand(Pause);
            StopMediaCommand      = new Command.StopMediaCommand(Stop);
            SpeedUpMediaCommand   = new Command.SpeedUpMediaCommand(UpgradeSpeed);
            SpeedDownMediaCommand = new Command.SpeedDownMediaCommand(DowngradeSpeed);
            NextMediaCommand      = new Command.NextMediaCommand(NextMedia);
            PrevMediaCommand      = new Command.PrevMediaCommand(PrevMedia);

            CurrentMediaName = "Current Media";

            Image        = new Media.Image();
            MediaElement = new Media.Video();
            Image.Display(AppDomain.CurrentDomain.BaseDirectory + "../../images/WindowsMediaPlayerLogo.png");
        }
コード例 #4
0
        string getVideoUrl(Media.Video video)
        {
            XmlDocument doc = new XmlDocument();

            do
            {
                doc.LoadXml(get("video.get.xml", "owner_id=" + video.Owner_id + "&videos=" + video.Owner_id + '_' + video.Id + '_' + video.Access_key));
            }while (doc.DocumentElement.Name != "response");
            if (doc.DocumentElement.ChildNodes[1].ChildNodes.Count != 0)
            {
                foreach (XmlNode item in doc.DocumentElement.ChildNodes[1].ChildNodes[0].ChildNodes)
                {
                    if (item.Name == "player")
                    {
                        video.Player = item.FirstChild.Value;
                    }
                }
            }
            return(video.Player);
        }