private void AddNewVertice(SilverlightEdge edge1, SilverlightEdge edge2) { if (!Vertice.CheckIfVerticeExist(edge1.Edge, edge2.Edge)) { SilverlightVertice vertice = new SilverlightVertice(edge1.Position, edge2.Position); vertice.Line.MouseLeftButtonDown += new MouseButtonEventHandler(line_MouseLeftButtonDown); edge1.Edge.AddVertice(new Vertice(edge2.Edge)); edge2.Edge.AddVertice(new Vertice(edge1.Edge)); this.LayoutRoot.Children.Add(vertice.Line); } }
private void AddNewEdge(Point p, int index) { SilverlightEdge edge = new SilverlightEdge(index, p); edge.MouseLeftButtonDown += new MouseButtonEventHandler(edge_MouseLeftButtonDown); this.LayoutRoot.Children.Add(edge); Edge newEdge = new Edge(index); edge.Edge = newEdge; _edges.Add(newEdge); _slEdges.Add(edge); }
private void DrawLines(List <int> order, Cluster cluster) { for (int i = 0; i < order.Count - 1; i++) { SilverlightEdge edge1 = cluster.Edges.Where(x => x.EdgeNumber == order[i]).First(); SilverlightEdge edge2 = cluster.Edges.Where(x => x.EdgeNumber == order[i + 1]).First(); SilverlightVertice vertice = new SilverlightVertice(edge1.Position, edge2.Position); vertice.Color = cluster.Color; this.LayoutRoot.Children.Add(vertice.Line); } SilverlightEdge edge11 = cluster.Edges.Where(x => x.EdgeNumber == order[order.Count - 1]).First(); SilverlightEdge edge22 = cluster.Edges.Where(x => x.EdgeNumber == order[0]).First(); SilverlightVertice vertice1 = new SilverlightVertice(edge11.Position, edge22.Position); vertice1.Color = cluster.Color; this.LayoutRoot.Children.Add(vertice1.Line); }
void edge_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { SilverlightEdge edge = sender as SilverlightEdge; if ((ModifierKeys.Alt & Keyboard.Modifiers) != 0) { this.LayoutRoot.Children.Remove(edge); ReorderEdges(edge.Edge.Number); } else { if (!_oneSelected) { _oneSelected = true; _edge1 = edge; } else { _oneSelected = false; _edge2 = edge; AddNewVertice(_edge1, _edge2); } } }
private void AddNewEdge(Point p,int index) { SilverlightEdge edge = new SilverlightEdge(index,p); edge.MouseLeftButtonDown += new MouseButtonEventHandler(edge_MouseLeftButtonDown); this.LayoutRoot.Children.Add(edge); Edge newEdge = new Edge(index); edge.Edge = newEdge; _edges.Add(newEdge); _slEdges.Add(edge); }