public SaveEntityResult SendComment(Comment comment)
 {
     return vtServiceFacade.SendComment(comment, incomingUserInfo);
 }
 public SaveEntityResult SendComment(Comment comment, string token)
 {
     ITokenValidator validator = new DatabaseTokenValidator();
     if (validator.IsValid(token))
         return new VtecTeamDBManager().SendComment(comment);
     throw new FaultException("Срок рабочей сессии истек, преезапустите программу");
 }
        private async void btnSendComment_Click(object sender, EventArgs e)
        {
            var currentStatus = PanelRefresh.StartRefresh(this, pbSendComment);
            await Task.Run(() =>
            {
                var comment = new Comment
                {
                    CommentDate = DateTime.Now,
                    CommentText = txtComment.Text,
                    RequestId = request.Id,
                    //UserId = Session.CurrentUser.Id,
                    User = Session.CurrentUser
                };

                RequestExecutor.Execute(()=>
                {
                    var savedComment = WCFServiceFactory.CreateVtecTeamService().SendComment(comment);

                    this.Invoke(() => pbRefreshRequest.Image = !savedComment.Result ? Properties.Resources.Error : null);
                    this.Invoke(() =>
                    {
                        if (savedComment.Result)
                        {
                            AddNode(txtUserName.Text, comment.CommentText, comment.CommentDate);
                            txtComment.Text = "";

                            comment.Id = savedComment.EntityId;
                            // f*****g magic to add new item in fixed size array
                            var commentsArray = request.Comments.ToArray();
                            Array.Resize(ref commentsArray, commentsArray.Length + 1);
                            commentsArray[commentsArray.Length - 1] = comment;
                            request.Comments = commentsArray;
                        }
                        else
                            MessageBox.Show("Не удалось отправить комментарий.");
                    });
                });

            });
            pbSendComment.Visible = false;
            PanelRefresh.StopRefresh(currentStatus);
        }