예제 #1
0
        private void GenerateCircuit(CircuitSimulator circuit)
        {
            Canvas.Children.Clear();
            List <INode> startNodes = circuit.GetStartNodes();
            Dictionary <string, UIElement> nodesDone = new Dictionary <string, UIElement>();
            List <string> connectionsDone            = new List <string>();
            int           x = 0;
            int           y = 0;

            foreach (INode node in startNodes)
            {
                DrawNode(node, nodesDone, x, y, connectionsDone);
                y += nodeMarginY;
            }
        }
예제 #2
0
        private void BuildCircuit(object sender, RoutedEventArgs e)
        {
            string         path   = "";
            OpenFileDialog file   = new OpenFileDialog();
            bool?          result = file.ShowDialog();

            if (result ?? false)
            {
                path = file.FileName;
            }
            if (!path.Equals(""))
            {
                output_Text.Text = String.Empty;
                circuit          = circuitBuilder.BuildHashmap(circuitBuilder.ReadFile(path));
                AddCheckboxes(circuit.GetStartNodes());
                GenerateCircuit(circuit);
            }
            else
            {
                Console.WriteLine("Error: " + path);
            }
        }
예제 #3
0
 public CircuitBuilder()
 {
     Nodes        = new Dictionary <string, string>();
     Edges        = new Dictionary <string, List <string> >();
     this.circuit = new CircuitSimulator();
 }