Esempio n. 1
0
        /**********************************/
        /* Graphs Functions               */
        /**********************************/
        // Reading its matrix representation stored in a .txt file
        private void toolStripRightGraphTXT_Click(object sender, EventArgs e)
        {
            try
            {
                // File Dialog properties setup.
                OpenFileGraph.FileName = "undirectedConnected";
                OpenFileGraph.Filter   = "txt files (*.txt)|*.txt";

                if (OpenFileGraph.ShowDialog() == DialogResult.OK)
                {
                    graphAlObj.ReadGraphFromTXTFile(OpenFileGraph.FileName);
                    ListBoxImport.Items.Add(OpenFileGraph.FileName);
                }
                else
                {
                    // Cancel Button.
                }
            }
            catch (FormatException)
            {
                MessageBox.Show("File Format Not Accepted");
                toolStripStatusLabelReady.Text = "Ready!";
                ListBoxImport.Items.Clear();
            }
        }