private void PostButton_Clicked(object sender, EventArgs e) { if (SendEditor.Text == null) { return; } else if (SendEditor.Text.Length == 0) { return; } var commentManager = CommentSystemManager.NewCommentPoster(); PostButton.IsEnabled = false; commentManager.Result += (status, comment) => { Device.BeginInvokeOnMainThread(() => { if (status == CommentManagerStatus.Success) { DependencyService.Get <IToast>().LongToast("Komentaras sėkmingai išsiųstas"); Items.Add(new CommentModel { Name = LocalUserManager.LocalUser.FirstName + " " + LocalUserManager.LocalUser.LastName, Username = comment.Username, Message = comment.Message, CreatedDate = DateTime.Now.ToFullDate(), Comment = comment, ImageLocation = LocalUserManager.LocalUser.ProfilePictureLocation }); CommentList.ScrollTo(Items.LastOrDefault(), ScrollToPosition.End, false); } else { DependencyService.Get <IToast>().LongToast("Komentaras nebuvo išsiųstas"); } PostButton.IsEnabled = true; }); }; commentManager.PostComment(new Comment { Message = SendEditor.Text, HelpRequestID = viewModel.HelpRequestModel.HelpRequest.Id, Username = LocalUserManager.LocalUser.Username }); SendEditor.Text = ""; }