//删除任务的实现方法 public void taskDelete(Object id) { MySqlConnection conn = null; string taskId = (string)id; try { //获取本模拟器的编号并通过命令行删除 conn = DatabaseOpt.getDBConnection(); string emulatorId = DatabaseOpt.queryOne(conn, taskId, "emulatorId")[0]; if (!"".Equals(emulatorId)) { //说明模拟器已创建,通过命令行删除 EmulatiorOpt.removeEmu(emulatorId); } //删除该条任务信息 DatabaseOpt.deleteOne(conn, taskId); } catch { MessageBox.Show("删除任务出错"); } finally { DatabaseOpt.close(conn); TaskInfoDataGridViewOpt.updateTaskInfoDataGridView(this.taskInfoDataGridView); } }