示例#1
0
        /// <summary>
        /// Method for creating new random <see cref="graph"/> instance with
        /// given number of nodes in <see cref="NodeCount"/> window.
        /// </summary>
        private void Menu_NewRandom_Click(object sender, RoutedEventArgs e)
        {
            NodeCount nodeCountPopUp = new NodeCount();
            int       nodeCount;

            if (nodeCountPopUp.ShowDialog() == true)
            {
                sequentialCounter = 0;
                nodeCount         = Int32.Parse(nodeCountPopUp.Answer);
                graph             = new Graph.Graph(MainCanvas, nodeCount);
                graph.DrawGraph();
                ResetStats();
                EnableMenu();
            }

            e.Handled = true;
        }
示例#2
0
        /// <summary>
        /// Method for creating new <see cref="graph"/> instance with
        /// given number of <see cref="Graph.Node"/> in <see cref="NodeCount"/> window
        /// and user-added <see cref="Graph.Edge"/>s.
        /// </summary>
        private void Menu_New_Click(object sender, RoutedEventArgs e)
        {
            NodeCount nodeCountPopUp = new NodeCount();

            if (nodeCountPopUp.ShowDialog() == true)
            {
                int           nodeCount     = Int32.Parse(nodeCountPopUp.Answer);
                MatrixCreator matrixCreator = new MatrixCreator(nodeCount);

                if (matrixCreator.ShowDialog() == true)
                {
                    graph = new Graph.Graph(MainCanvas, matrixCreator.AdjecencyMatrix);
                    graph.DrawGraph();
                    ResetStats();
                    EnableMenu();
                }
            }

            e.Handled = true;
        }