private void btnSave_Click(object sender, EventArgs e)
        {
            NewGuGanLianXiRenForm form = new NewGuGanLianXiRenForm(null);

            if (form.ShowDialog() == DialogResult.OK)
            {
                MainForm.Instance.RefreshEditorWithoutRTFTextEditor();
            }
        }
 private void dgvDetail_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     if (dgvDetail.Rows[e.RowIndex].Tag != null)
     {
         Task task = (Task)dgvDetail.Rows[e.RowIndex].Tag;
         NewGuGanLianXiRenForm form = new NewGuGanLianXiRenForm(task);
         if (form.ShowDialog() == DialogResult.OK)
         {
             MainForm.Instance.RefreshEditorWithoutRTFTextEditor();
         }
     }
 }
        private void dgvDetail_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (dgvDetail.Rows.Count >= 1)
            {
                if (e.ColumnIndex == dgvDetail.Columns.Count - 3)
                {
                    if (dgvDetail.Rows[e.RowIndex].Tag != null)
                    {
                        Task task = (Task)dgvDetail.Rows[e.RowIndex].Tag;
                        MoveToDown(e.RowIndex, task);
                    }
                }

                if (e.ColumnIndex == dgvDetail.Columns.Count - 4)
                {
                    if (dgvDetail.Rows[e.RowIndex].Tag != null)
                    {
                        Task task = (Task)dgvDetail.Rows[e.RowIndex].Tag;
                        MoveToUp(e.RowIndex, task);
                    }
                }

                if (e.ColumnIndex == dgvDetail.Columns.Count - 2)
                {
                    if (dgvDetail.Rows[e.RowIndex].Tag != null)
                    {
                        Task task = (Task)dgvDetail.Rows[e.RowIndex].Tag;

                        NewGuGanLianXiRenForm form = new NewGuGanLianXiRenForm(task);
                        if (form.ShowDialog() == DialogResult.OK)
                        {
                            MainForm.Instance.RefreshEditorWithoutRTFTextEditor();
                        }
                    }
                }

                if (e.ColumnIndex == dgvDetail.Columns.Count - 1)
                {
                    if (dgvDetail.Rows[e.RowIndex].Tag != null)
                    {
                        Task task = (Task)dgvDetail.Rows[e.RowIndex].Tag;
                        if (MessageBox.Show("真的要删除吗?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
                        {
                            ConnectionManager.Context.table("Task").where ("ID='" + task.ID + "'").delete();
                            MainForm.Instance.RefreshEditorWithoutRTFTextEditor();
                        }
                    }
                    else
                    {
                        if (e.ColumnIndex == dgvDetail.Columns.Count - 1)
                        {
                            if (MessageBox.Show("真的要删除吗?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
                            {
                                try
                                {
                                    dgvDetail.Rows.RemoveAt(e.RowIndex);
                                }
                                catch (Exception ex)
                                {
                                    UpdateTaskList();
                                }
                            }
                        }
                    }
                }
            }
        }