} //END OF ReadGraph METHOD /// <summary> /// Event handler for the Open Button, generates a solution to the traveling /// salesmen proble, /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void uxOpenButton_Click(object sender, EventArgs e) { if(uxOpenDialog.ShowDialog() == DialogResult.OK) { try { UndirectedGraph graph = ReadGraph(uxOpenDialog.FileName); MSTNode parent = graph.GetMinSpanningTree(); uxTour.Text = parent.Walk(); new TreeForm(parent, 100).Show(); }catch(Exception ex) { MessageBox.Show("This error has occurred " + ex.ToString()); } //END OF TRY-CATCH BLOCK } //END OF IF STATEMENT } //END OF EVENT HANDLER
/// <summary> /// the event handler for the Load Graph button /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void uxOpenButton_Click(object sender, EventArgs e) { if (uxOpenDialog.ShowDialog() == DialogResult.OK) { try { UndirectedGraph graph = ReadGraph(uxOpenDialog.FileName); MSTNode tree = graph.GetMinSpanningTree(); new TreeForm(tree, 100).Show(); uxTour.Text = tree.Walk(); } catch (Exception ex) { MessageBox.Show("The following error occurred: " + ex); } } }