Пример #1
0
        /// <summary>
        /// Open new editing window to change comment's data.
        /// </summary>
        /// <param name="sender">The control/object that raised the event.</param>
        /// <param name="e">Event Data.</param>
        /// <param name="comment">Comment. Editing window will contain info about it.</param>
        private void CommentButton_Click(object sender, RoutedEventArgs e, Comment comment)
        {
            CommentEditWindow commentEditWindow = new CommentEditWindow(CurrentLoggedInUser, comment);

            commentEditWindow.Closing += (s, args) => { Reload(); };
            commentEditWindow.Show();
        }
Пример #2
0
 private void UpdateComment(Requirement requirement)
 {
   var comment = requirement.Comments.CurrentItem;
   if (comment == null || requirements.CurrentItem == null)
     return;
   if (!comment.CreateUserID.Equals(HomeViewModel.Instance.CurrentUserID))
   {
     MessageBox.Show("不是你的评论不能修改及删除!");
     return;
   }
   var c = comment.ToString().Load<Comment>();
   var viewModel = new CommentEditWindow(c);
   DialogWindowHelper.ShowDialogWindow(viewModel, result =>
   {
     if (result)
     {
       IWriteService service = new WcfClientAddressBase<WriteServiceClient>("../WriteService.svc").GetService();
       service.BeginUpdateComment(viewModel.Data.ToString(), requirements.CurrentItem.Id,
         ThreadHelper.SyncContextCallback(ar => Globals.ProcessAsyncServiceData(() =>
         {
           string message = service.EndUpdateComment(ar);
           if (string.IsNullOrEmpty(message))
             LoadComment();
           else
             MessageBox.Show(message);
         })), null);
     }
   });
 }
Пример #3
0
 private void AddComment(Requirement requirement)
 {
   if (requirement == null)
     return;
   var c = new Comment
   {
     CreateUserID = HomeViewModel.Instance.CurrentUserID,
     CreateUserName = HomeViewModel.Instance.CurrentUser.Name
   };
   var viewModel = new CommentEditWindow(c);
   DialogWindowHelper.ShowDialogWindow(viewModel, result =>
   {
     if (result)
     {
       #region save to service
       IWriteService service = new WcfClientAddressBase<WriteServiceClient>("../WriteService.svc").GetService();
       service.BeginInsertComment(viewModel.Data.ToString(), requirement.Id,
         ThreadHelper.SyncContextCallback(ar => Globals.ProcessAsyncServiceData(() =>
         {
           string message = service.EndInsertComment(ar);
           if (string.IsNullOrEmpty(message))
             LoadComment();
           else
             MessageBox.Show(message);
         })), null);
       #endregion
     }
   });
 }