public Feed(RssSchema schema) { Title = schema.Title ?? ""; Summary = schema.Summary ?? ""; Content = schema.Content ?? ""; string theme = AppTools.GetLocalSetting(Enums.AppSettings.Theme, "Light").ToLower(); ImageUrl = schema.ImageUrl; if (string.IsNullOrEmpty(ImageUrl)) { ImgVisibility = Visibility.Collapsed; } else if (ImageUrl.StartsWith("//")) { ImageUrl = "http:" + ImageUrl; } ExtraImageUrl = schema.ExtraImageUrl ?? ""; MediaUrl = schema.MediaUrl ?? ""; InternalID = schema.InternalID; FeedUrl = schema.FeedUrl; Author = schema.Author ?? AppTools.GetReswLanguage("App_NoAuthor"); Date = schema.PublishDate.ToString(AppTools.GetReswLanguage("App_DateFormat")); Categories = schema.Categories; if (Categories == null || Categories.Count() == 0) { TagVisibility = Visibility.Collapsed; } }
public ItemProjetoResumo(Glass.Data.Model.ItemProjeto itemProjeto) { IdItemProjeto = (int)itemProjeto.IdItemProjeto; IdProjetoModelo = (int)itemProjeto.IdProjetoModelo; Valor = itemProjeto.Total.ToString("c", new CultureInfo("pt-BR")); ImageUrl = itemProjeto.ImagemUrlMini.Replace("~/", ServiceLocator.Current.GetInstance <Glass.Api.IConfiguracao>().EnderecoServicoImagem); CodigoModelo = itemProjeto.CodigoModelo; IdCorVidro = (int)itemProjeto.IdCorVidro; EspessuraVidro = itemProjeto.EspessuraVidro; if (!ImageUrl.StartsWith(ServiceLocator.Current.GetInstance <Glass.Api.IConfiguracao>().EnderecoServicoImagem)) { ImageUrl = string.Format("{0}{1}", ServiceLocator.Current.GetInstance <Glass.Api.IConfiguracao>().EnderecoServicoImagem, ImageUrl); } Ambiente = itemProjeto.Ambiente; var materiais = Glass.Data.DAL.MaterialItemProjetoDAO.Instance.GetList(itemProjeto.IdItemProjeto, string.Empty, 0, 1); if (materiais.FirstOrDefault() != null) { ValorCobradoM2 = materiais.FirstOrDefault().Valor.ToString("c", new CultureInfo("pt-BR")); DescricaoProduto = materiais.FirstOrDefault().DescrProduto; } }
public override void OnDraw(Graphics2D graphics2D) { if (!hasBeenLoaded) { if (ImageUrl.StartsWith("http")) { WebCache.RetrieveImageSquenceAsync(sequenceWidget.ImageSequence, ImageUrl); } hasBeenLoaded = true; } base.OnDraw(graphics2D); }
public string ValidateUrl() { if (string.IsNullOrEmpty(ImageUrl)) { return(null); } //for Test if (ImageUrl.StartsWith('/') || ImageUrl.StartsWith("http://", StringComparison.OrdinalIgnoreCase) || ImageUrl.StartsWith("https://", StringComparison.OrdinalIgnoreCase)) { return(null); } return("Url Error"); }
public override void OnDraw(Graphics2D graphics2D) { if (!hasBeenLoaded) { if (ImageUrl.StartsWith("http")) { WebCache.RetrieveImageSquenceAsync(imageSequence, ImageUrl, () => { this.MinStretchOrFitHorizontal(20, imageSequence.Width); UiThread.RunOnIdle(() => { if (aggRenderer.RootWidget.Parents <MarkdownWidget>().FirstOrDefault() is MarkdownWidget markdownWidget) { markdownWidget.Width = markdownWidget.Width + 1; } }); }); } hasBeenLoaded = true; } base.OnDraw(graphics2D); }
/// <summary> /// Convert the page object to XElement. /// </summary> /// <param name="withNamespace"></param> /// <returns>A xelement contains web page definition.</returns> public XElement Element(bool withNamespace = false) { XNamespace ns = "http://www.dotnetage.com/XML/Schema/page"; XNamespace wns = "http://www.dotnetage.com/XML/Schema/widget-data"; var element = new XElement(ns + PAGE, new XAttribute("xmlns", ns), new XAttribute(VIEWMODE, (PageViewModes)this.ViewMode), new XAttribute(SLUG, this.Slug)); if (withNamespace) { element.Add(new XAttribute(XNamespace.Xmlns + "w", wns)); } #region attributes if (!this.ShowInMenu) { element.Add(new XAttribute(SHOW_IN_MENU, false)); } if (!this.ShowInSitemap) { element.Add(new XAttribute(SHOW_IN_SITEMAP, false)); } if (!this.AllowAnonymous) { element.Add(new XAttribute(ANONYMOUS, false)); if (this.Roles != null && this.Roles.Length > 0) { element.Add(new XAttribute(ROLES, string.Join(",", this.Roles))); } } if (this.IsStatic) { element.Add(new XAttribute(STATIC, true)); } if (this.IsShared) { element.Add(new XAttribute(SHARED, true)); } if (!string.IsNullOrEmpty(this.Target)) { element.Add(new XAttribute(TARGET, this.Target)); } if (!string.IsNullOrEmpty(this.Dir)) { element.Add(new XAttribute(DIR, this.Dir)); } #endregion #region elements if (!string.IsNullOrEmpty(Title)) { element.Add(new XElement(ns + TITLE, this.Title)); } if (!string.IsNullOrEmpty(Description)) { element.Add(new XElement(ns + DESC, new XCData(this.Description))); } if (!string.IsNullOrEmpty(Keywords)) { element.Add(new XElement(ns + KEY_WORDS, this.Keywords)); } if (!string.IsNullOrEmpty(this.LinkTo)) { element.Add(new XElement(ns + LINK, this.LinkTo)); } if (!string.IsNullOrEmpty(this.IconUrl)) { if (IconUrl.StartsWith("data:image")) { element.Add(new XElement(ns + ICON, new XCData(IconUrl))); } else { element.Add(new XElement(ns + ICON, "images/" + System.IO.Path.GetFileName(this.IconUrl))); } } if (!string.IsNullOrEmpty(this.ImageUrl)) { if (ImageUrl.StartsWith("data:image")) { element.Add(new XElement(ns + ICON, new XCData(ImageUrl))); } else { element.Add(new XElement(ns + IMAGE, new XAttribute("src", "images/" + System.IO.Path.GetFileName(this.ImageUrl)))); } } if (!string.IsNullOrEmpty(this.ViewName) || !string.IsNullOrEmpty(this.ViewData)) { var layout = new XElement(ns + LAYOUT); if (!string.IsNullOrEmpty(this.ViewName)) { if (string.IsNullOrEmpty(this.ViewData)) { layout.Add(new XAttribute(NAME, this.ViewName)); } } if (!string.IsNullOrEmpty(this.ViewData)) { layout.Add(new XCData(this.ViewData)); } element.Add(layout); } if (this.StyleSheets != null && this.StyleSheets.Length > 0) { foreach (var ss in StyleSheets) { var fileName = System.IO.Path.GetFileName(ss); element.Add(new XElement(ns + STYLE, new XAttribute(SRC, "css/" + fileName))); } } if (this.Scripts != null && this.Scripts.Length > 0) { foreach (var s in Scripts) { var fileName = System.IO.Path.GetFileName(s); element.Add(new XElement(ns + SCRIPT, new XAttribute(SRC, "scripts/" + fileName))); } } #endregion #region pages if (this.Children != null && this.Children.Count() > 0) { var childrenElement = new XElement(ns + PAGES); foreach (var child in Children) { if (child.IsStatic && child.IsStatic) { continue; } childrenElement.Add(child.Element()); } element.Add(childrenElement); } #endregion #region widgets if (this.Widgets != null && this.Widgets.Count() > 0) { var widgetsElement = new XElement(ns + WIDGETS); foreach (var widget in this.Widgets) { if (widget.PageID == this.ID) { widgetsElement.Add(widget.Element()); } } element.Add(widgetsElement); } #endregion return(element); }
public string GetThumbnailUrl(string cdnUrl, string containerName) => ImageUrl.StartsWith("http") ? ImageUrl : Flurl.Url.Combine(cdnUrl, containerName, $"entry/{Id}.{extension}?width=64&height=64&cb={System.Guid.NewGuid()}");