private void OnDeleteClick(object sender, EventArgs e) { try { if (MessageBox.Show("确认要删除么?", Constants.MESSAGEBOX_CAPTION, MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button2) == DialogResult.OK) { TaskNode tn = this.SelectedNode as TaskNode; TaskInfo task = null; if (tn != null) { task = tn.Task; } if (task != null) { string ret = ConfigCtrl.DeleteTask(task); if (ret != Constants.STATUS_SUCCESS) { MessageBox.Show(ret, Constants.MESSAGEBOX_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } BaseNode bn = (BaseNode)tn.Parent; bn.Nodes.Remove(tn); } } } catch (Exception ex) { ErrorHandler.ShowMessageBox(TaskConstants.EXCEPTION_MODULE, ex); } }