private void StartFirstThread() { var apiInfo = new TwitterApiInfo { AccessToken = "313315355-DT9HzoZKyLC4WbfKblVh5KAMyE0IGvtx5XFDtUx5", AccessTokenSecret = "7BhEPtC9RaQK0VIHmrugaimXXoOYjxxVhZGpcxw1w", ConsumerKey = "hYd5c8gYxhy3T2Nvj8wLA", ConsumerSecret = "KZGPvAN6kgioWlf0zrGYOzKevLatexuuuJlIhJQg" }; var provider = new TwitterDataProvider(apiInfo); try { var result = provider.GetUrlOfUserImage("kamorin_roman", TwitterDataProvider.ImageSize.Small); var messages = provider.GetUserHomeTimeLine(10); } catch (Exception) { } Console.WriteLine("First thread complete"); }
public string UploadUserAvatarFromSocialNetwork(int contactId, SocialNetworks socialNetwork, string userIdentity, bool uploadOnly) { if (socialNetwork != SocialNetworks.Twitter && socialNetwork != SocialNetworks.Facebook && socialNetwork != SocialNetworks.LinkedIn) throw new ArgumentException(); if (socialNetwork == SocialNetworks.Twitter) { TwitterDataProvider provider = new TwitterDataProvider(TwitterApiHelper.GetTwitterApiInfoForCurrentUser()); string imageUrl = provider.GetUrlOfUserImage(userIdentity, TwitterDataProvider.ImageSize.Original); return UploadAvatar(contactId, imageUrl, uploadOnly); } if (socialNetwork == SocialNetworks.Facebook) { FacebookDataProvider provider = new FacebookDataProvider(FacebookApiHelper.GetFacebookApiInfoForCurrentUser()); string imageUrl = provider.GetUrlOfUserImage(userIdentity, FacebookDataProvider.ImageSize.Original); return UploadAvatar(contactId, imageUrl, uploadOnly); } if (socialNetwork == SocialNetworks.LinkedIn) { LinkedInDataProvider provider = LinkedInApiHelper.GetLinkedInDataProviderForCurrentUser(); string imageUrl = provider.GetUrlOfUserImage(userIdentity); return UploadAvatar(contactId, imageUrl, uploadOnly); } return null; }
public string UploadUserAvatarFromSocialNetwork(int contactID, SocialNetworks socialNetwork, string userIdentity, bool uploadOnly) { try { //Process authorization if (!ProcessAuthorization(HttpContext.Current)) { AccessDenied(HttpContext.Current); return null; } if (socialNetwork == SocialNetworks.Twitter) { TwitterDataProvider provider = new TwitterDataProvider(TwitterApiHelper.GetTwitterApiInfoForCurrentUser()); string imageUrl = provider.GetUrlOfUserImage(userIdentity, TwitterDataProvider.ImageSize.Original); return UploadAvatar(contactID, imageUrl, uploadOnly); } if (socialNetwork == SocialNetworks.Facebook) { FacebookDataProvider provider = new FacebookDataProvider(FacebookApiHelper.GetFacebookApiInfoForCurrentUser()); string imageUrl = provider.GetUrlOfUserImage(userIdentity, FacebookDataProvider.ImageSize.Original); return UploadAvatar(contactID, imageUrl, uploadOnly); } if (socialNetwork == SocialNetworks.LinkedIn) { LinkedInDataProvider provider = LinkedInApiHelper.GetLinkedInDataProviderForCurrentUser(); string imageUrl = provider.GetUrlOfUserImage(userIdentity); return UploadAvatar(contactID, imageUrl, uploadOnly); } return null; } catch (Exception ex) { throw ProcessError(ex, "UploadUserAvatarFromSocialNetwork"); } }
private List<SocialMediaImageDescription> GetTwitterImageDescriptionList(Contact contact, Tenant tenant) { CoreContext.TenantManager.SetCurrentTenant(tenant); var images = new List<SocialMediaImageDescription>(); var twitterAccounts = Global.DaoFactory.GetContactInfoDao().GetListData(contact.ID, ContactInfoType.Twitter); if (twitterAccounts.Count == 0) return images; var provider = new TwitterDataProvider(TwitterApiHelper.GetTwitterApiInfoForCurrentUser()); images.AddRange(from twitterAccount in twitterAccounts let imageUrl = provider.GetUrlOfUserImage(twitterAccount, TwitterDataProvider.ImageSize.Small) where imageUrl != null select new SocialMediaImageDescription { Identity = twitterAccount, ImageUrl = imageUrl, SocialNetwork = SocialNetworks.Twitter }); return images; }
private List<SocialMediaImageDescription> GetTwitterImageDescriptionList(List<String> twitterAccounts, Tenant tenant) { var images = new List<SocialMediaImageDescription>(); if (twitterAccounts.Count == 0) return images; try { CoreContext.TenantManager.SetCurrentTenant(tenant); var provider = new TwitterDataProvider(TwitterApiHelper.GetTwitterApiInfoForCurrentUser()); twitterAccounts = twitterAccounts.Distinct().ToList(); images.AddRange(from twitterAccount in twitterAccounts let imageUrl = provider.GetUrlOfUserImage(twitterAccount, TwitterDataProvider.ImageSize.Small) where imageUrl != null select new SocialMediaImageDescription { Identity = twitterAccount, ImageUrl = imageUrl, SocialNetwork = SocialNetworks.Twitter }); } catch (Exception ex) { _logger.Error(ex); } return images; }