private void BT_RestriccionAbajo_Click(object sender, EventArgs e) { int indice = LB_listaRestricciones.SelectedIndex; IRestriccion item = (IRestriccion)LB_listaRestricciones.SelectedItem; listaRestricciones.Remove(item); listaRestricciones.Insert(indice + 1, item); LB_listaRestricciones.ClearSelected(); LB_listaRestricciones.SelectedIndex = indice + 1; }
private void BT_AgregarALista_Click(object sender, EventArgs e) { if (editaRestriccion) { int ubicacion = LB_listaRestricciones.SelectedIndex; //listaRestricciones.Remove((IRestriccion)LB_listaRestricciones.SelectedItem); //listaRestricciones.Insert(ubicacion, restriccionesActuales()); foreach (IRestriccion restriccion in listaRestriccionesAsociadas) { listaRestricciones.Remove(restriccion); } int i = 0; foreach (IRestriccion restriccion in restriccionesActuales()) { listaRestricciones.Insert(ubicacion + i, restriccion); i++; } editaRestriccion = false; LB_listaRestricciones.Enabled = true; LB_listaRestricciones.ClearSelected(); LB_listaRestricciones.SelectedIndex = ubicacion; } else { foreach (IRestriccion restriccion in restriccionesActuales()) { restriccion.agregarALista(listaRestricciones); LB_listaRestricciones.ClearSelected(); } } limpiarPrescripcion(); if (!CB_Estructura.Items.Contains(estructura().nombre)) { CB_Estructura.Items.Add(estructura().nombre); } fijarEsParaExtraccion(); }
private void BT_AgregarALista_Click(object sender, EventArgs e) { if (editaRestriccion) { int ubicacion = LB_listaRestricciones.SelectedIndex; listaRestricciones.Remove((IRestriccion)LB_listaRestricciones.SelectedItem); listaRestricciones.Insert(ubicacion, restriccionActual()); editaRestriccion = false; LB_listaRestricciones.Enabled = true; LB_listaRestricciones.ClearSelected(); LB_listaRestricciones.SelectedIndex = ubicacion; } else { restriccionActual().agregarALista(listaRestricciones); LB_listaRestricciones.ClearSelected(); } limpiarPrescripcion(); if (!CB_Estructura.Items.Contains(estructura().nombre)) { CB_Estructura.Items.Add(estructura().nombre); } fijarEsParaExtraccion(); }