本文整理汇总了C#中TweetSharp.TwitterService.StreamUser方法的典型用法代码示例。如果您正苦于以下问题:C# TwitterService.StreamUser方法的具体用法?C# TwitterService.StreamUser怎么用?C# TwitterService.StreamUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TweetSharp.TwitterService
的用法示例。
在下文中一共展示了TwitterService.StreamUser方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ListenOnUserStream
public static void ListenOnUserStream(TwitterService service)
{
service.AuthenticateWith(accessToken, accessTokenSecret);
Console.WriteLine("Starting Listen");
service.StreamUser((streamEvent, response) =>
{
Console.WriteLine(streamEvent.RawSource);
});
Console.ReadLine();
service.CancelStreaming();
Console.WriteLine("Ending Listen");
}
示例2: TwitterModelClass
public TwitterModelClass(string ck, string cs, string act, string acts, TwitterViewerForm form)
{
/*
tokens.AccessToken = act;
tokens.AccessTokenSecret = acts;
tokens.ConsumerKey = ck;
tokens.ConsumerSecret = cs;
*/
tws = new TwitterService(ck, cs, act, acts);
parentForm = form;
tws.StreamUser((streamEvent, response) =>
{
if (response.StatusCode == 0)
{
if (streamEvent is TwitterUserStreamStatus)
{
TwitterStatus tweet = ((TwitterUserStreamStatus)streamEvent).Status;
parentForm.Invoke((MethodInvoker)delegate
{
((Form1)parentForm).InvokedTwitterStatus(tweet);
});
}else if( streamEvent is TwitterUserStreamDeleteStatus )
{
TwitterUserStreamDeleteStatus dstatus = streamEvent as TwitterUserStreamDeleteStatus;
parentForm.Invoke((MethodInvoker)delegate
{
((Form1)parentForm).InvokedDeleteStatus(dstatus.StatusId);
});
}
else if (streamEvent is TwitterUserStreamEvent)
{
TwitterUserStreamEvent evt = streamEvent as TwitterUserStreamEvent;
}
}
}
);
tws.StreamFilter((streamEvent, response) =>
{
if (response.StatusCode == 0)
{
new System.Media.SoundPlayer(@"C:\WINDOWS\Media\Windows Balloon.wav").Play();
}
}
);
RestClient client = tws._client;
RestRequest req = tws.PrepareHammockQuery("help/configuration.json");
RestResponse res = client.Request(req);
Newtonsoft.Json.Linq.JContainer obj
= Newtonsoft.Json.JsonConvert.DeserializeObject(res.Content)
as Newtonsoft.Json.Linq.JContainer;
int uh, uhs;
int.TryParse(obj["short_url_length"].ToString(), out uh);
int.TryParse(obj["short_url_length_https"].ToString(), out uhs);
Url_http = uh;
Url_https = uhs;
}