protected override void OnResult(string data) { List <TweetTemplate> loadedTweets = new List <TweetTemplate>(); Dictionary <string, object> statuses = ANMiniJSON.Json.Deserialize(data) as Dictionary <string, object>; List <object> tweets = statuses["statuses"] as List <object>; foreach (object tweet in tweets) { Dictionary <string, object> tweetJSON = (tweet as Dictionary <string, object>); TweetTemplate tpl = new TweetTemplate(); tpl.id = tweetJSON["id_str"] as string; tpl.created_at = tweetJSON["created_at"] as string; tpl.text = tweetJSON["text"] as string; tpl.source = tweetJSON["source"] as string; tpl.in_reply_to_status_id = tweetJSON["in_reply_to_status_id"] as string; tpl.in_reply_to_user_id = tweetJSON["in_reply_to_user_id"] as string; tpl.in_reply_to_screen_name = tweetJSON["in_reply_to_screen_name"] as string; tpl.geo = tweetJSON["geo"] as string; tpl.place = tweetJSON["place"] as string; tpl.lang = tweetJSON["lang"] as string; tpl.retweet_count = System.Convert.ToInt32(tweetJSON["retweet_count"] as string); tpl.favorite_count = System.Convert.ToInt32(tweetJSON["favorite_count"] as string); TwitterUserInfo user = new TwitterUserInfo(tweetJSON["user"] as IDictionary); tpl.user_id = user.id; TwitterDataCash.AddTweet(tpl); TwitterDataCash.AddUser(user); loadedTweets.Add(tpl); } TW_APIRequstResult result = new TW_APIRequstResult(true, data); result.tweets = loadedTweets; dispatch(BaseEvent.COMPLETE, result); }
protected override void OnResult(string data) { List <TwitterUserInfo> loadedUsers = new List <TwitterUserInfo>(); foreach (object user in ANMiniJSON.Json.Deserialize(data) as List <object> ) { TwitterUserInfo userInfo = new TwitterUserInfo(user as IDictionary); TwitterDataCash.AddUser(userInfo); loadedUsers.Add(userInfo); } TW_APIRequstResult result = new TW_APIRequstResult(true, data); result.users = loadedUsers; SendCompleteResult(result); }