Пример #1
0
        public async Task Retweet(Tweet tweet)
        {
            if (tweet.IsRetweet)
            {
                var id              = string.IsNullOrWhiteSpace(tweet.RetweetStatusId) ? tweet.StatusId : tweet.RetweetStatusId;
                var json            = Twitter.GetTweet(id);
                var status          = Status.ParseJson("[" + json + "]")[0];
                var retweetStatusId = status.CurrentUserRetweet.Id;
                await Twitter.DestroyStatus(retweetStatusId);

                tweet.IsRetweet = false;
            }
            else
            {
                await Twitter.RetweetStatus(tweet.StatusId);

                tweet.IsRetweet = true;
            }
        }
Пример #2
0
        public async Task Search(string query)
        {
            try
            {
                IsSearching = true;
                _search.Clear();
                Timeline.Clear();
                var json = await Twitter.Search(query);

                var statuses = SearchStatuses.ParseJson(json);
                foreach (var status in statuses.Where(s => s.RetweetedStatus == null))
                {
                    _search.Add(status.CreateTweet(TweetClassification.Search));
                }
                Timeline.AddRange(_search);
            }
            finally
            {
                IsSearching = false;
            }
        }