public async Task <AttachmentsDetailModel> LoadDetailItemData(Post item, ModeAttachments mode) { return(await Task.Run(async() => { WebClient web = new WebClient(); if (mode == ModeAttachments.Attachments) { s = await web.DownloadStringTaskAsync(item.Links.Attachment.ToString()); } else { s = await web.DownloadStringTaskAsync(item.Links.FeaturedMedia.ToList()[0].Href); } // XmlSerializer xml = new XmlSerializer(typeof(AttachmentsDetailModel)); AttachmentsDetailModel res = JsonConvert.DeserializeObject <AttachmentsDetailModel>(s); //= xml.Deserialize(new MemoryStream(Encoding.UTF8.GetBytes(s))) as AttachmentsDetailModel; return res; } )); }
public AttachmentsDetailPost() { items = new AttachmentsDetailModel(); Task t = LoadDetailItemData(post, localmode); }