Example #1
0
        /// <summary>
        /// Método que actualiza la lista de variables en el listbox
        /// </summary>
        public void actualizarListaDeReglas()
        {
            listBox_reglas.Items.Clear();
            string[]  id_reglas  = base_conocimiento.listarReglas();
            ArrayList aux_reglas = new ArrayList();

            if (id_reglas != null)
            {
                for (int i = 0; i < id_reglas.Length; i++)
                {
                    Regla           regla    = base_conocimiento.leerRegla(id_reglas[i]);
                    ElementoListBox elemento = new ElementoListBox()
                    {
                        id     = regla.id_regla,
                        nombre = "" + regla
                    };
                    string aux = "";
                    if (!regla.chequeo_de_consistencia)
                    {
                        aux += "(No Chequeado)";
                    }
                    elemento.prefijo = aux;
                    //listBox_reglas.Items.Add(elemento);
                    aux_reglas.Add(elemento);
                }
            }

            aux_reglas.Sort(new ElementoListBox());
            foreach (ElementoListBox item in aux_reglas)
            {
                listBox_reglas.Items.Add(item);
            }
            listBox_reglas.Refresh();
        }
Example #2
0
 private void listBox_reglas_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (listBox_reglas.SelectedItem != null && control_edicion_de_reglas.tipo_tarea == ControlEdicionReglas.DESABILITADO)
     {
         ElementoListBox elemento = (ElementoListBox)listBox_reglas.SelectedItem;
         control_edicion_de_reglas.mostrarRegla(elemento.id);
     }
 }
Example #3
0
 private void button_modificar_Click(object sender, EventArgs e)
 {
     if (listBox_reglas.SelectedItem != null && control_edicion_de_reglas.tipo_tarea == ControlEdicionReglas.DESABILITADO)
     {
         habilitarControles(false);
         ElementoListBox elemento = (ElementoListBox)listBox_reglas.SelectedItem;
         control_edicion_de_reglas.iniciarTareaModificaciónRegla(elemento.id);
         listBox_reglas.SelectedItem = null;
     }
     else
     {
         MessageBox.Show("No se ha seleccionado ninguna regla.", "Gestión de reglas", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
 public void listarHechos()
 {
     listBox_hechos.Items.Clear();
     string[] ids_hechos = base_conocimiento.listarHechos();
     for (int i = 0; i < ids_hechos.Length; i++)
     {
         Hecho           hecho    = base_conocimiento.leerHecho(ids_hechos[i]);
         ElementoListBox elemento = new ElementoListBox()
         {
             id     = hecho.id_hecho,
             nombre = hecho + ""
         };
         listBox_hechos.Items.Add(elemento);
     }
     listBox_hechos.Refresh();
 }
Example #5
0
            public int Compare(object x, object y)
            {
                ElementoListBox a   = (ElementoListBox)x;
                ElementoListBox b   = (ElementoListBox)y;
                string          a_n = a.id.Replace("R_", "");
                string          b_n = b.id.Replace("R_", "");

                try
                {
                    int number_a = Int16.Parse(a_n);
                    int number_b = Int16.Parse(b_n);
                    return(number_a.CompareTo(number_b));
                }
                catch (Exception) {}
                return(0);
            }