private void RemoveEdges() { for (int i = 0; i < edgesToRemove.Count; i++) { string edgeUid = DrawObj.GenerateEdgeUid(edgesToRemove[i]); for (int j = 0; j < MWindow.mainCanvas.Children.Count; j++) { if (MWindow.mainCanvas.Children[j].Uid == edgeUid) { MWindow.mainCanvas.Children.RemoveAt(j); break; } } } edgesToRemove.Clear(); }
private void AddEdge(EdgesAddedOrRemoved edge) { edgesToChangeColor.Add(edge); Line edgeElem = new Line { Uid = DrawObj.GenerateEdgeUid(edge), Stroke = (SolidColorBrush) new BrushConverter().ConvertFromString("#006600"), StrokeThickness = 2, X1 = DrawObj.Vertices[edge.Vertex1].X, Y1 = DrawObj.Vertices[edge.Vertex1].Y, X2 = DrawObj.Vertices[edge.Vertex2].X, Y2 = DrawObj.Vertices[edge.Vertex2].Y }; MWindow.mainCanvas.Children.Add(edgeElem); }
private void PrepareEdgeToRemove(EdgesAddedOrRemoved edge) { edgesToRemove.Add(edge); string edgeUid = DrawObj.GenerateEdgeUid(edge); for (int j = 0; j < MWindow.mainCanvas.Children.Count; j++) { if (MWindow.mainCanvas.Children[j].Uid == edgeUid) { Line line = (Line)MWindow.mainCanvas.Children[j]; line.Stroke = (SolidColorBrush) new BrushConverter().ConvertFromString("#ff0000"); line.StrokeThickness = 2; break; } } }
private void FixAddedEdes() { for (int i = 0; i < edgesToChangeColor.Count; i++) { string edgeUid = DrawObj.GenerateEdgeUid(edgesToChangeColor[i]); for (int j = 0; j < MWindow.mainCanvas.Children.Count; j++) { if (MWindow.mainCanvas.Children[j].Uid == edgeUid) { Line line = (Line)MWindow.mainCanvas.Children[j]; line.Stroke = (SolidColorBrush) new BrushConverter().ConvertFromString("#323336"); line.StrokeThickness = 1; break; } } } edgesToChangeColor.Clear(); }