/// <summary> /// 元ツイートに対する返信を取得する /// </summary> /// <param name="data">返信の取得情報</param> public async void ReadMoreRepliesToMainStatus(SearchRepliesProperties data) { if (this.IsLoadingRepliesToMainStatus) { return; } this.IsLoadingRepliesToMainStatus = true; while (true) { if (this.IsLoadingReplies) { await Task.Run(() => { System.Threading.Thread.Sleep(3000); }); if (this.IsLoadingRepliesToMainStatus) { this.IsLoadingRepliesToMainStatus = false; } } else { break; } } this.IsLoadingRepliesToMainStatus = true; var searchQuery = "to:" + data.ScreenName; var mentionStatuses = await AccountTokens.LoadSearchTimelineAsync(this.TimelineModel.TokenSuffix, searchQuery, data.MaxId, data.SinceId, "false"); while (true) { if (mentionStatuses != null && mentionStatuses.Count != 0) { var replyIds = mentionStatuses.Where(x => x.InReplyToStatusId == this.Id).Select(x => x.Id).ToList(); var suffix = this.GetSuffix(); if (replyIds.Count != 0) { foreach (var mentionStatus in (await AccountTokens.LookupStatusAsync(this.TimelineModel.TokenSuffix, replyIds)).OrderByDescending(x => x.Id)) { if (suffix != -1) { this.Statuses.Insert(suffix + 1, new TimelineItemProperties(this.TimelineModel, mentionStatus, StatusType.IndividualOther)); } } } mentionStatuses = await AccountTokens.LoadSearchTimelineAsync(this.TimelineModel.TokenSuffix, searchQuery, mentionStatuses.Last().Id - 1, data.SinceId, "false"); } else { break; } } for (int i = 1; i < this.Statuses.Count; i++) { if (this.Statuses[i].TimelineItemType == TimelineItemType.Button && this.Statuses[i].LoadingProperties != null) { this.Statuses.RemoveAt(i); } } this.IsLoadingRepliesToMainStatus = false; }