Exemplo n.º 1
0
        public Simulador(String path, String stringInicio, String stringFinal)
        {
            InitializeComponent();
            grafo       = new CGrafo();
            nuevoNodo   = null;
            var_control = 0;
            ListaNodos.inicio();
            ListaNodos.ReadFile(path);
            String inicio = stringInicio;
            String final  = stringFinal;

            Vertice        = new Vertice();
            listaRecorrido = ListaNodos.AEstrella(ListaNodos.BuscaNodo(stringInicio), ListaNodos.BuscaNodo(stringFinal));
            this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint |
                          ControlStyles.OptimizedDoubleBuffer, true);
        }
Exemplo n.º 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                //Get the path of specified file
                string filePath = openFileDialog1.FileName;
                textBox1.Text = filePath;

                LlenarGrafo grafo = new LlenarGrafo();
                grafo.inicio();
                grafo.ReadFile(filePath);
                foreach (Nodo nodo in grafo.Grafo)
                {
                    listBox1.Items.Add(nodo.Nombre);
                    listBox2.Items.Add(nodo.Nombre);
                }
            }
        }