private void button4_Click(object sender, EventArgs e) { if (treeView1.SelectedNode != null) { rep.eliminar(treeView1.SelectedNode); } treeView1.Focus(); }
private void button2_Click(object sender, EventArgs e) { mostrarError(""); if (validarNombre(textBox1.Text)) { if (!rep.existeRecurso(textBox1.Text, rep.getArbol().TreeView.SelectedNode)) { List <ArchivoTorrent> listaT = new List <ArchivoTorrent>(); for (int i = 0; i < listBox1.Items.Count; i++) { listaT.Add(new ArchivoTorrent((String)listBox1.Items[i])); } textBox2.Text = textBox2.Text.Replace("<", "["); textBox2.Text = textBox2.Text.Replace(">", "]"); if (editar) { rep.eliminar(); editar = false; } String p; RecursoTorrent recTorrent; bool escarpintermedia = false; if (pathmedio != "") { p = pathmedio + "/"; recTorrent = new RecursoTorrent(textBox1.Text, listaT, textBox2.Text, p); pathmedio = ""; escarpintermedia = true; } else { recTorrent = new RecursoTorrent(textBox1.Text, listaT, textBox2.Text); } rep.insertarRecurso(recTorrent, escarpintermedia, pathmedio); Close(); } else { mostrarError("Ya existe recurso con ese nombre"); } } else { mostrarError("Nombre de recurso no válido"); } }