Quantcast
Channel: Tweetinvi a friendly Twitter C# library
Viewing all articles
Browse latest Browse all 4126

Commented Unassigned: How to retreive notifications from stream [2245]

$
0
0
Ehm i'm not so practice with C# and API's,at the moment i'm using c# to imteplement twitter notifications to my software. But i have some issues with this code,when i try run this code the program seems to be in an infinite loop. Autentication works well cause i tried to post a new tweet and it works,this is the only part that have problems.



C#

private void Button1_Click(object sender, RoutedEventArgs e)
{
var credentials = TwitterCredentials.CreateCredentials("Access_Token", "Access_Token_Secret", "Consumer_Key", "Consumer_Secret");
TwitterCredentials.ExecuteOperationWithCredentials(credentials, () =>
{
var userStream = Stream.CreateUserStream();
userStream.TweetCreatedByMe += (s, a) => { text1.Text = ("I posted {0}"+ a.Tweet.Text); };
userStream.TweetCreatedByFriend += (s, a) => { text1.Text=("{0} posted {1}"+ a.Tweet.Creator.Name+ a.Tweet.Text); };
userStream.MessageReceived += (s, a) => { text1.Text =("You received the message : {0}"+a.Message.Text); };
userStream.StartStream();
});
}
Comments: ** Comment from web user: linvi **

This is an infinite loop. You need to run the the stream in its own thread if you do not want to block the UI Thread.


Viewing all articles
Browse latest Browse all 4126

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>