Hi the crazy gang,
As some of you may know, from vvvv facebook group, I am building the ultimate twitter API plug in for vvvv, a complete Twitter REST API 1.1 bridge. I have had great success porting over TWEETINVI C# API for Twitter to a vvvv plugin. Everything works well but now i am trying to make the plug in “asynchronous” so that instead of vvvv “stalling” for a second or two during search it nicely trickles the results through one by one (slowing down frame rate but still better than a complete freeze. As I said, I sue TWEETINVI C# API which is brilliant ANd comes with async versions of all fucntions. This is a simpel c# problem, I am not the best c# dev and have little knowledge of asynchronism in c#… This is what I use and works perfect as non async, liek that:
(after building serachparameters, I call:)
var tweets = Search.SearchTweets(searchParameter);
foreach(var tweet in tweets){
//DO LOTS (essentially copy tweet.text to listTweetText and so on…)
}
THAT WORKS FINE, now when i try and use the async verison of search then i can’t use “foreach” and i understand why but then what is the correct syntax? so here it is:
var tweets = SearchAsync.SearchTweets(searchParameter);
OR Task<List> = SearchAsync.SearchTweets(searchParameter);
And then… how do i recreate a foreach looop that basically goes through all the task result and do something EVERYTIME a new result comes through, something like “foreach(var tweet in tweets)” but that works asynchronously. Maybe: var results = tweets.REsults; if(results!=null){//do lots}
ALSO shouldn’t I make my outputs that are ISPREAD something like IAsyncReSult? Do I have to change anything in my output pin declaration to make the output pin “asynchronous”
Sorry this is actually mostly a C# question but it’s for a vvvv plug in that i am making for everyone to use(not just myself, this is a contribution)
THANKX!