/// <summary> /// close todo /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnCloseTodo_Click(object sender, EventArgs e) { if (selectTodo == null && selectComplete == null) { MessageBox.Show("none selected"); return; } var todo = selectTodo; if (todo == null) { todo = selectComplete; } if (MessageBox.Show("确定永久删除[" + todo.Content + "]吗?", "永久删除", MessageBoxButtons.OKCancel) == DialogResult.OK) { if (TodoDao.Delete(todo.AddTime)) { selectTodo = null; selectComplete = null; initListData(); } else { MessageBox.Show("fail"); } } }
/// <summary> /// close complete /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnCloseComplete_Click(object sender, EventArgs e) { if (MessageBox.Show("确定彻底删除吗?", "彻底删除", MessageBoxButtons.OKCancel) == DialogResult.OK) { if (selectComplete == null) { MessageBox.Show("none selected"); return; } if (TodoDao.Delete(selectComplete.AddTime)) { selectComplete = null; initListData(); } else { MessageBox.Show("fail"); } } }