public List <CommonDataTypes.SocialElements.Post> GetAllPosts(CommonDataTypes.SocialElements.User user, long limit = 0) { if (limit <= 0) { limit = long.MaxValue; } IPosts posts = new VKPosts(); if (user == null) { user = new CommonDataTypes.SocialElements.User() { Uid = Common.Api.UserId.Value }; } posts.GetPostNotificationEvent += Posts_GetPostNotificationEvent; List <CommonDataTypes.SocialElements.Post> allPosts = new List <CommonDataTypes.SocialElements.Post>(100000); List <CommonDataTypes.SocialElements.Post> currentPosts = null; ulong offset = 0; try { do { currentPosts = posts.FromUser(user, 100, offset); offset += 100; allPosts.AddRange(currentPosts); System.Threading.Thread.Sleep(200); } while (currentPosts != null && currentPosts.Count > 0 && allPosts.Count < limit); } catch (Exception ex) { } return(allPosts); }
public void DeletePost(long postUID) { IPosts posts = new VKPosts(); posts.DeletePost(postUID); }