private async void ReplyTextBox_SendReply(object sender, string e) { if (!string.IsNullOrEmpty(ReplyTextBox.AtUser)) { e = $"回复 @{ReplyTextBox.AtUser} :" + e; } var result = await _client.AddReplyAsync(_oid, e, _selectReplyId, _rootId, _type); if (result != null) { ReplyTextBox.ClearText(); ReplyTextBox.PlaceholderText = "输入回复"; if (result.parent_str == _rootId) { ReplyCollection.Add(result); ScrollViewer.ChangeView(0, 9999, 1); } else { var parent = ReplyCollection.Where(p => p.rpid_str == result.parent_str).FirstOrDefault(); var index = ReplyCollection.IndexOf(parent); ReplyCollection.Insert(index, result); } HolderText.Visibility = ReplyCollection.Count == 0 ? Visibility.Visible : Visibility.Collapsed; } }
public async Task Init(string replyId, string oid, string type) { LoadingRing.IsActive = true; _rootId = replyId; _oid = oid; _type = type; _next = 0; _prev = 0; _isEnd = false; _isRequesting = false; _selectReplyId = replyId; ReplyCollection.Clear(); ReplyTextBox.ClearText(); HeaderBlock.Visibility = Visibility.Visible; NoDataContainer.Visibility = Visibility.Collapsed; await LoadReply(); LoadingRing.IsActive = false; }