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

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