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; } }
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); } }
public CircuitBuilder() { Nodes = new Dictionary <string, string>(); Edges = new Dictionary <string, List <string> >(); this.circuit = new CircuitSimulator(); }