示例#1
0
        protected override void OnAddItems(ScrapedPage page)
        {
            if (this.kryptonPanel1.Controls.Contains(this.kryptonLabelPrivacy))
            {
                this.kryptonPanel1.Controls.Remove(this.kryptonLabelPrivacy);
            }

            for (var i = 0; i < Constants.GetMaxDisplayCount(page.Videos.Count); i++)
            {
                var video  = page.Videos[i];
                var widget = new WebViewWidget(video,
                                               Properties.Resources.TestHtml.Replace("{0}", video.Url).Replace("{1}", video.ImageUrl).
                                               Replace("{2}", video.Title).Replace("{3}", video.Duration.ToString()));
                this.flowLayoutPanel.Controls.Add(widget);
                widget.ViewSelected += delegate(object sender, GalleryItemSelectedEventArgs e)
                {
                    OnItemSelected(sender, e);
                };

                if (Constants.ShowAds && i % 4 == 0)
                {
                    var ad = CreateAdWidget(Constants.HorizontalAdId);
                    this.flowLayoutPanel.Controls.Add(ad);
                }
            }
        }
 private WebViewWidget AddItem(ScrapedVideo video)
 {
     var widget = new WebViewWidget(video, Properties.Resources.TestHtml.Replace("{0}", video.Url).Replace("{1}", video.ImageUrl).
              Replace("{2}", video.Title).Replace("{3}", video.Duration.ToString()));
     widget.Anchor = AnchorStyles.Left | AnchorStyles.Right;
     widget.Width = this.Width;
     this.tableLayoutPanel.Controls.Add(widget);
     Application.DoEvents();
     widget.ViewSelected += delegate(object sender, GalleryItemSelectedEventArgs e)
     {
         OnItemSelected(sender, e);
     };
     return widget;
 }
示例#3
0
        private WebViewWidget AddItem(ScrapedVideo video)
        {
            var widget = new WebViewWidget(video, Properties.Resources.TestHtml.Replace("{0}", video.Url).Replace("{1}", video.ImageUrl).
                                           Replace("{2}", video.Title).Replace("{3}", video.Duration.ToString()));

            widget.Anchor = AnchorStyles.Left | AnchorStyles.Right;
            widget.Width  = this.Width;
            this.tableLayoutPanel.Controls.Add(widget);
            Application.DoEvents();
            widget.ViewSelected += delegate(object sender, GalleryItemSelectedEventArgs e)
            {
                OnItemSelected(sender, e);
            };
            return(widget);
        }
        protected override void OnAddItems(ScrapedPage page)
        {
            if (this.kryptonPanel1.Controls.Contains(this.kryptonLabelPrivacy))
                this.kryptonPanel1.Controls.Remove(this.kryptonLabelPrivacy);

            for (var i = 0; i < Constants.GetMaxDisplayCount(page.Videos.Count); i++)
            {
                var video = page.Videos[i];
                var widget = new WebViewWidget(video,
                    Properties.Resources.TestHtml.Replace("{0}", video.Url).Replace("{1}", video.ImageUrl).
                       Replace("{2}", video.Title).Replace("{3}", video.Duration.ToString()));
                this.flowLayoutPanel.Controls.Add(widget);
                widget.ViewSelected += delegate(object sender, GalleryItemSelectedEventArgs e)
                {
                    OnItemSelected(sender, e);
                };

                if (Constants.ShowAds && i % 4 == 0)
                {
                    var ad = CreateAdWidget(Constants.HorizontalAdId);
                    this.flowLayoutPanel.Controls.Add(ad);
                }
            }
        }