private double GenerateMarket() { double num = 0.0; NewsItem newsItem = this._newsItemData.NewsItem; if (this._headerItem == null) { this._headerItem = new UserOrGroupHeaderItem(this.Width, new Thickness(), true, newsItem.date, (User)null, this._newsItemData.Groups.FirstOrDefault <Group>((Func <Group, bool>)(g => g.id == -this._newsItemData.NewsItem.source_id)), "", PostIconType.None, PostSourcePlatform.None, new Action(this.OnMoreOptionsTap), null, ""); this._headerItem.SetMenu(this.GenerateMenuItems()); this.VirtualizableChildren.Add((IVirtualizable)this._headerItem); } this._headerItem.ViewMargin = new Thickness(); double top = num + (this._headerItem.FixedHeight + 16.0); if (this._marketItem == null) { Product product = new Product() { owner_id = newsItem.owner_id, id = newsItem.id, title = newsItem.title, thumb_photo = newsItem.thumb_photo, availability = newsItem.availability, price = newsItem.price, category = newsItem.category }; Link link1 = new Link(); link1.title = newsItem.title; link1.caption = CommonResources.Product; link1.photo = new Photo() { photo_75 = newsItem.thumb_photo }; LinkProduct linkProduct = new LinkProduct(product); link1.product = linkProduct; string str = string.Format("http://vk.com/product{0}_{1}", (object)product.owner_id, (object)product.id); link1.url = str; Link link = link1; NewsLinkUCBase tmpUC = (NewsLinkUCBase) new NewsLinkMediumUC(); tmpUC.Initialize(link, this.Width); this._marketItem = new UCItem(this.Width - 16.0, new Thickness(), (Func <UserControlVirtualizable>)(() => { NewsLinkMediumUC newsLinkMediumUc = new NewsLinkMediumUC(); //Link link = link; double width = this.Width; newsLinkMediumUc.Initialize(link, width); return((UserControlVirtualizable)newsLinkMediumUc); }), (Func <double>)(() => tmpUC.CalculateTotalHeight()), (Action <UserControlVirtualizable>)null, 0.0, false); this.VirtualizableChildren.Add((IVirtualizable)this._marketItem); } this._marketItem.ViewMargin = new Thickness(8.0, top, 8.0, 0.0); return(top + this._marketItem.FixedHeight + 16.0); }
private void GenerateLayout() { Thickness margin = new Thickness(); Action moreOptionsTapCallback = new Action(this.OnMoreOptionsTap); NewsItem newsItem1 = this._newsItemWithInfo.NewsItem; this._videos = (newsItem1 != null ? newsItem1.video : (VKList <VKClient.Common.Backend.DataObjects.Video>)null) ?? new VKList <VKClient.Common.Backend.DataObjects.Video>(); string extraText = UIStringFormatterHelper.FormatNumberOfSomething(this._videos.count, CommonResources.OneVideoFrm, CommonResources.TwoFourVideosFrm, CommonResources.FiveVideosFrm, true, null, false); this._header = new UserOrGroupHeaderItem(this.Width, margin, this.OwnerId < 0L, this._newsItemWithInfo.NewsItem.date, this._fromUser, this._fromGroup, extraText, PostIconType.None, PostSourcePlatform.None, moreOptionsTapCallback, new Action(this.onNavigatedToUserOrGroup), ""); this.VirtualizableChildren.Add((IVirtualizable)this._header); margin.Top += 12.0 + this._header.FixedHeight + 2.0; List <Attachment> list = this._videos.items.Take <VKClient.Common.Backend.DataObjects.Video>(5).Select <VKClient.Common.Backend.DataObjects.Video, Attachment>((Func <VKClient.Common.Backend.DataObjects.Video, Attachment>)(v => new Attachment() { type = "video", video = v })).ToList <Attachment>(); double desiredHeight = list.Count != 1 ? (list.Count < 2 || list.Count > 4 ? 580.0 : 430.0) : 280.0; NewsItem newsItem2 = this._newsItemWithInfo.NewsItem; string itemId = newsItem2.source_id != 0L ? newsItem2.source_id.ToString() : ""; this._thumbsItem = new ThumbsItem(this.Width, new Thickness(0.0, margin.Top, 0.0, 0.0), list, false, itemId, false, false, false, 0.0, desiredHeight); this.VirtualizableChildren.Add((IVirtualizable)this._thumbsItem); margin.Top += this._thumbsItem.FixedHeight; if (this._videos.items.Count > 5) { UCItem ucItem = new UCItem(this.Width, margin, (Func <UserControlVirtualizable>)(() => { return((UserControlVirtualizable) new ShowMoreCommentsUC() { Height = 64.0, Text = CommonResources.ShowAll, OnClickAction = new Action(this.HandleShowAll) }); }), (Func <double>)(() => 64.0), (Action <UserControlVirtualizable>)null, 0.0, false); this.VirtualizableChildren.Add((IVirtualizable)ucItem); margin.Top += ucItem.FixedHeight; } else if (this._videos.items.Count == 1) { this.LikesAndCommentsItem = new LikesAndCommentsItem(this.Width, margin, this._videos.items[0], new Action(this.CommentsTapped)); this.VirtualizableChildren.Add((IVirtualizable)this.LikesAndCommentsItem); margin.Top += this.LikesAndCommentsItem.FixedHeight; } else { margin.Top += 12.0; } this._height = margin.Top + 16.0; }
private double GenerateTopic() { double top1 = 0.0; if (this._headerItem == null) { this._headerItem = new UserOrGroupHeaderItem(this.Width, new Thickness(), true, this._newsItemData.NewsItem.date, null, this._newsItemData.Groups.FirstOrDefault <Group>((Func <Group, bool>)(g => g.id == -this._newsItemData.NewsItem.source_id)), "", PostIconType.None, PostSourcePlatform.None, new Action(this.OnMoreOptionsTap), null, ""); this._headerItem.SetMenu(this.GenerateMenuItems()); this.VirtualizableChildren.Add((IVirtualizable)this._headerItem); } this._headerItem.ViewMargin = new Thickness(0.0, top1, 0.0, 0.0); double top2 = top1 + (this._headerItem.FixedHeight + 16.0); if (this._topicTextItem == null) { this._topicTextItem = new TextItem(this.Width - 32.0, new Thickness(), this._newsItemData.NewsItem.text, false, 32.0, "Segoe WP SemiLight", 0.0, Application.Current.Resources["PhoneContrastTitleBrush"] as SolidColorBrush, true, null); this.VirtualizableChildren.Add((IVirtualizable)this._topicTextItem); } this._topicTextItem.ViewMargin = new Thickness(16.0, top2, 16.0, 0.0); return(top2 + (this._topicTextItem.FixedHeight + 16.0)); }