private void btnDeleteCamera_Click(object sender, EventArgs e) { try { Camera camera = cameras[lbCameras.SelectedIndex]; if (camera == curCamera) { MessageBox.Show("当前正在监控此摄像头,无法删除!"); return; } sqlite.deleteCamera(camera); lbCameras.Items.RemoveAt(lbCameras.SelectedIndex); cameras.Remove(camera); } catch (System.Data.SQLite.SQLiteException ex) { MessageBox.Show("删除失败!出现错误:\n" + ex.Message); _log.Error(ex); } }