public override void OnFileSaved() { base.OnFileSaved(); if (!UserConnection.GetIsFeatureEnabled("LinkPreview")) { return; } var fileType = Entity.GetTypedColumnValue <Guid>("TypeId"); if (fileType == Terrasoft.WebApp.FileConsts.LinkTypeUId) { var url = Entity.GetTypedColumnValue <string>("Name").Trim(); if (IsURLValid(url)) { LinkPreview linkPreview = new LinkPreview(); LinkPreviewInfo linkPreviewInfo = linkPreview.GetWebPageLinkPreview(url); if (linkPreviewInfo != null) { LinkPreviewProvider linkPreviewProvider = new LinkPreviewProvider(UserConnection); linkPreviewProvider.SaveLinkPreviewInfo(linkPreviewInfo, Entity.PrimaryColumnValue); } } } }
public LinkPreviewServiceResponse GetWebPageLinkPreview(string url) { LinkPreview linkPreview = CreateLinkPreview(); LinkPreviewServiceResponse response = new LinkPreviewServiceResponse(); try { response.LinkPreviewInfo = linkPreview.GetWebPageLinkPreview(url); } catch (Exception e) { response.Exception = e; } return(response); }