/// <summary>
        /// Sets the data context for the video window.
        /// </summary>
        /// <param name="dataContext">The data context</param>
        public void SetDataContext(VideoClipViewModel dataContext)
        {
            this.DataContext = dataContext;

            HtmlViewer.SourceUri       = dataContext.VideoLink;
            HtmlViewerDetails.HtmlCode = dataContext.HtmlCode;
        }
Ejemplo n.º 2
0
        void VideoWindowView_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
        {
            VideoClipViewModel vm = (VideoClipViewModel)e.NewValue;

            string str = vm.VideoLink.ToString();

            var x = System.Environment.OSVersion.Version;

            if (x.Major == 6 && x.Minor == 1)
            {
                str = str.Replace("/v/", "/watch?v=");
                str = str.Replace(vm.VideoLink.Query.ToString(), "");

                this.htmlViewer.Navigate(str);

                this.theExpander.Visibility = System.Windows.Visibility.Collapsed;
            }
            else
            {
                this.htmlViewer.NavigateToString(String.Format(player, str));

                if (vm.HtmlCode != string.Empty)
                {
                    string htmlString = "<html> <head> <meta charset='UTF-8'> </head> <body> <p>" + vm.HtmlCode + "</p> </body> </html>";
                    this.detailViewer.NavigateToString(htmlString);
                }
            }
        }
Ejemplo n.º 3
0
        public async Task <ActionResult> Edit(int?id)
        {
            VideoClip videoClip = await Database.VideoClips.FindAsync(id);

            VideoClipViewModel videoClipViewModel = new VideoClipViewModel
            {
                Id          = videoClip.ID,
                Name        = videoClip.Name,
                Description = videoClip.Description,
                Path        = videoClip.Path
            };

            return(View(videoClipViewModel));
        }
Ejemplo n.º 4
0
        public async Task <ActionResult> Create([Bind(Include = "Name, Description, Path")] VideoClipViewModel model)
        {
            if (ModelState.IsValid)
            {
                VideoClip videoClip = new VideoClip(model);
                videoClip.UploadedBy = CurrentUser;
                Database.VideoClips.Add(videoClip);
                await Database.SaveChangesAsync();

                return(RedirectToAction("List"));
            }

            return(View(model));
        }
Ejemplo n.º 5
0
        public async Task <ActionResult> Edit([Bind(Include = "Id, Name, Description, Path")] VideoClipViewModel model)
        {
            if (ModelState.IsValid)
            {
                VideoClip videoClip = await Database.VideoClips.FindAsync(model.Id);

                Database.Entry(videoClip).State = EntityState.Modified;
                videoClip.Name        = model.Name;
                videoClip.Description = model.Description;
                videoClip.Path        = model.Path;
                await Database.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(model));
        }