public DirectedWindow() { InitializeComponent(); Graph = GraphGenerator.CreateDirectional(GraphGenerator.generatorGER(10, 11)); Renderer = new DirectionalGraphRenderer(Graph, GraphControl, VM); Graph.OnChange += onGraphChange; GraphControl.OnLineClick += createWeight; GraphControl.OnTwoNodeClickEvent += ConnectTwoNodes; Graph.OnChange(); DataContext = VM; }
private void createWeight(LineViewModel lineVM) { if (VM.ShowWeights) { var dialog = new SelectWeightWindow(); dialog.Weight = Graph.getWeight(lineVM.StartNode, lineVM.EndNode); dialog.ShowDialog(); int node1 = lineVM.StartNode; int node2 = lineVM.EndNode; int weight = dialog.Weight; Graph.setWeight(node1, node2, weight); Graph.OnChange(); } }