本文整理汇总了C#中TweetSharp.TwitterService.ListFriends方法的典型用法代码示例。如果您正苦于以下问题:C# TwitterService.ListFriends方法的具体用法?C# TwitterService.ListFriends怎么用?C# TwitterService.ListFriends使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TweetSharp.TwitterService
的用法示例。
在下文中一共展示了TwitterService.ListFriends方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Get
public List<Models.User> Get(bool invite = false)
{
List<Models.User> output = new List<Models.User>();
Models.Service service = _db.User.FirstOrDefault(c => c.UserId == WebSecurity.CurrentUserId).Services.FirstOrDefault(c => c.Provider == "twitter");
if (service != null)
{
TwitterService twitter = new TwitterService(Settings.Settings.TwitterConsumerKey, Settings.Settings.TwitterConsumerSecret, service.Token, service.TokenSecret);
var friends = twitter.ListFriends().ToList();
foreach (var friend in friends)
{
var username = OAuthWebSecurity.GetUserName("twitter", friend.Id.ToString());
if (username != null && invite == false)
{
int Id = WebSecurity.GetUserId(username);
Models.User user = _db.User.FirstOrDefault(c => c.UserId == Id);
output.Add(user);
}
else if(username == null && invite == true)
{
output.Add(new Models.User { Id = friend.Id, Image=friend.ProfileImageUrl, Name=friend.ScreenName});
}
}
}
return output;
}
示例2: GetContacts
public IEnumerable<ChannelContact> GetContacts()
{
var service = new TwitterService(ChannelHelper.ConsumerKey, ChannelHelper.ConsumerSecret, ChannelHelper.Token, ChannelHelper.TokenSecret);
var result = service.ListFriends();
foreach (var user in result)
{
var contact = new ChannelContact { IsSoft = true };
contact.Profile.ChannelProfileKey = user.Id.ToString();
contact.Person.Name = user.Name;
contact.Profile.ScreenName = user.ScreenName;
contact.Profile.SourceAddress = new SourceAddress(user.Id.ToString(), user.Name);
contact.Profile.ProfileType = ProfileType.Social;
contact.Profile.Url = user.Url;
contact.Profile.Title = user.Description;
contact.Profile.Location = user.Location;
contact.Profile.ChannelAvatar = new ChannelAvatar();
contact.Profile.ChannelAvatar.Url = user.ProfileImageUrl;
yield return contact;
}
}