private async void OnResult(ArticlesComments result) { if (result != null) { await formsWebView.InjectJavascriptAsync("updateComment(" + JsonConvert.SerializeObject(result) + ");"); } }
private void OnResult(ArticlesComments result) { if (result != null) { ViewModel.AddComment(result); ArticlesDetailsView.ScrollTo(ViewModel.ArticlesComments.Last(), ScrollToPosition.Start, false); } }
public void AddComment(ArticlesComments comment) { ArticlesComments.Add(comment); if (LoadStatus == LoadMoreStatus.StausNodata) { LoadStatus = LoadMoreStatus.StausEnd; } ArticlesDetails.CommentDisplay = (articles.CommentCount + 1).ToString(); }
private void ClosePopupPage(string result) { if (result != null) { ArticlesComments cmment = new ArticlesComments(); cmment.Author = UserSettings.Current.DisplayName; cmment.AuthorUrl = UserSettings.Current.Avatar; cmment.FaceUrl = UserSettings.Current.Face; cmment.Body = result; cmment.DateAdded = DateTime.Now; cmment.Floor = 0; cmment.Id = 0; this.result.Invoke(cmment); } PopupNavigation.PopAsync(); }
async Task ExecuteCommentCommandAsync() { var result = await StoreManager.ArticlesDetailsService.GetCommentAsync(articles.BlogApp, articles.Id, pageIndex, pageSize); if (result.Success) { var comments = JsonConvert.DeserializeObject <List <ArticlesComments> >(result.Message.ToString()); if (comments.Count > 0) { if (pageIndex == 1 && ArticlesComments.Count > 0) { ArticlesComments.Clear(); } ArticlesComments.AddRange(comments); pageIndex++; if (ArticlesComments.Count >= pageSize) { LoadStatus = LoadMoreStatus.StausDefault; CanLoadMore = true; } else { LoadStatus = LoadMoreStatus.StausEnd; CanLoadMore = false; } } else { CanLoadMore = false; LoadStatus = pageIndex > 1 ? LoadMoreStatus.StausEnd : LoadMoreStatus.StausNodata; } } else { Log.SaveLog("ArticlesDetailsViewModel.GetCommentAsync", new Exception() { Source = result.Message }); LoadStatus = pageIndex > 1 ? LoadMoreStatus.StausError : LoadMoreStatus.StausFail; } }