Пример #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();
 }