private void btnAddComment_Click(object sender, EventArgs e) { var comment = _task.CreateComment(); using (var frm = new CommentAddEditForm(comment)) { if (frm.ShowDialog() == DialogResult.OK) { _task.Comments.Add(comment); gcComments.RefreshDataSource(); } } }
private void GvComments_DoubleClick(object sender, EventArgs e) { var view = sender as GridView; var comment = view.GetRow(view.FocusedRowHandle) as Task.Core.Comment; //TODO: Clone before provide to form var cloneComment = (Task.Core.Comment)comment.Clone(); using (var frm = new CommentAddEditForm(cloneComment)) { if (frm.ShowDialog() == DialogResult.OK) { int i = _task.Comments.IndexOf(comment); _task.Comments[i] = cloneComment; } } }