本文整理汇总了C#中LinqToTwitter.TwitterContext.Retweet方法的典型用法代码示例。如果您正苦于以下问题:C# TwitterContext.Retweet方法的具体用法?C# TwitterContext.Retweet怎么用?C# TwitterContext.Retweet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LinqToTwitter.TwitterContext
的用法示例。
在下文中一共展示了TwitterContext.Retweet方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Retweet
public JsonResult Retweet(string id)
{
Authorize();
twitterCtx = new TwitterContext(auth);
try
{
Status stat = twitterCtx.Retweet(id);
if (stat != null)
{
return Json(new { success = true });
}
else
{
return Json(new
{
success = false,
errorMessage = "Unknown Error"
});
}
}
catch (Exception ex)
{
return Json(new
{
success = false,
errorMessage = ex.Message
});
}
}
示例2: SearchAndRetweet
/// <summary>
/// shows how to perform a twitter search
/// </summary>
/// <param name="twitterCtx">TwitterContext</param>
private void SearchAndRetweet(TwitterContext twitterCtx)
{
foreach (string creteria in Properties.Settings.Default.SearchWords)
{
var queryResults =
from search in twitterCtx.Search
where search.Type == SearchType.Search &&
search.Query == creteria &&
search.Page == 2 &&
search.PageSize == Properties.Settings.Default.PageSize
select search;
foreach (var search in queryResults)
{
// here, you can see that properties are named
// from the perspective of atom feed elements
// i.e. the query string is called Title
m_logger.Info("Query:" + search.Title);
IOrderedEnumerable<AtomEntry> entries = search.Entries.OrderBy(ent => ent.Published);
DateTime lastPublished = Properties.Settings.Default.LastPublished;
foreach (var entry in entries)
{
m_logger.InfoFormat("Date:{3}, ID:{0}, Source:{1}, Content:{2}",
entry.ID, entry.Source, entry.Content, entry.Published.ToString("yyyy/MM/dd HH:mm:ss"));
if (lastPublished < entry.Published)
{
string hitIgnoreSource = ContainsWord(Properties.Settings.Default.IgnoreSources, entry.Source);
string hitIgnoreWord = ContainsWord(Properties.Settings.Default.IgnoreWords, entry.Content);
if (!String.IsNullOrEmpty(hitIgnoreSource))
{
m_logger.InfoFormat("投稿元に '{0}' が含まれるためスキップしました。", hitIgnoreSource);
}
if (!String.IsNullOrEmpty(hitIgnoreWord))
{
m_logger.InfoFormat("本文に '{0}' が含まれるためスキップしました。", hitIgnoreWord);
}
else
{
twitterCtx.Retweet(entry.ID.Substring(entry.ID.LastIndexOf(':') + 1));
m_logger.InfoFormat("リツイートしました");
}
Properties.Settings.Default.LastPublished = entry.Published;
Properties.Settings.Default.Save();
}
else
{
m_logger.InfoFormat("前回投稿日より古いためスキップしました");
}
}
}
}
}
示例3: Retweet
internal static void Retweet(TweetItem selectedItem)
{
if (_sampleDataSource._auth == null)
{
_sampleDataSource.InitGroups();
}
using (var twitterCtx = new TwitterContext(_sampleDataSource._auth))
{
Status response = twitterCtx.Retweet(selectedItem.UniqueId);
}
}
示例4: RetweetDemo
private static void RetweetDemo(TwitterContext twitterCtx)
{
var retweet = twitterCtx.Retweet("267070822643023874");
Console.WriteLine("Retweeted Tweet: ");
Console.WriteLine(
"\nUser: " + retweet.RetweetedStatus.User.Name +
"\nTweet: " + retweet.RetweetedStatus.Text +
"\nTweet ID: " + retweet.RetweetedStatus.ID + "\n");
}
示例5: RetweetDemo
private static void RetweetDemo(TwitterContext twitterCtx)
{
var retweet = twitterCtx.Retweet("11515561768");
Console.WriteLine("Retweeted Tweet: ");
Console.WriteLine(
"\nUser: " + retweet.Retweet.RetweetingUser.Name +
"\nTweet: " + retweet.Retweet.Text +
"\nTweet ID: " + retweet.Retweet.ID + "\n");
}