How to get notify for new message using TweetSharp ListDirectMessageReceived() method?


#1

I am using TweetSharp for making a small demo desktop application for twitter and I am using the below code for getting all the messages of a login user:-
Code:-

TwitterService service = new TwitterService(“ConsumerKey”, “ConsumerSecretKey”);
// Step 1 - Retrieve an OAuth Request Token
OAuthRequestToken requestToken = service.GetRequestToken();

// Step 2 - Redirect to the OAuth Authorization URL
Uri uri = service.GetAuthorizationUri(requestToken);
Process.Start(uri.ToString());

// Step 3 - Exchange the Request Token for an Access Token
Console.Write("Enter Pin:: ");
string verifier = Console.ReadLine(); // <-- This is input into your application by your user

OAuthAccessToken access = service.GetAccessToken(requestToken, verifier);

// Step 4 - User authenticates using the Access Token
service.AuthenticateWith(access.Token, access.TokenSecret);

string message = null;

List messages = new List();

IEnumerable directMessages = service.ListDirectMessagesReceived(new ListDirectMessagesReceivedOptions());

//Fetch all current direct message:
foreach (TwitterDirectMessage directMessage in directMessages)
{
//Write All Messages in Console
Console.WriteLine(directMessage.Text);
}

Above foreach loop will show all the messages but my problem is that when any other user send me new message then how can notifying me for new message.

Please help me!

If somehow we can get unread messages ID from Twitter API 1.1 then please let us know (If supported by Twitter).
Any Help Appreciated!

Thanx!