void dragHandle_DragCompleted(object sender, DragCompletedEventArgs e) { Point actualPos = Mouse.GetPosition(this); if (actualPos.X < 0 || actualPos.Y < 0) { visualChildren.Clear(); InvalidateArrange(); return; } linkStroke.path.Insert(indexInPath, new Coordinates(actualPos)); linkStroke.addStylusPointsToLink(); DrawingService.UpdateLinks(new StrokeCollection { linkStroke }); canvas.RefreshChildren(); InvalidateArrange(); visualChildren.Clear(); }
public void EditLink(string linkName, int linkType, int linkStyle, string selectedColor, int linkThickness, string multiplicityFrom, string multiplicityTo) { popUpLink.IsOpen = false; if (surfaceDessin.GetSelectedStrokes().Count == 1 && surfaceDessin.GetSelectedStrokes()[0] != null) { LinkStroke stroke = (LinkStroke)surfaceDessin.GetSelectedStrokes()[0]; stroke.name = linkName; stroke.style.type = linkStyle; stroke.style.color = selectedColor; stroke.style.thickness = linkThickness; stroke.from.multiplicity = multiplicityFrom; stroke.to.multiplicity = multiplicityTo; stroke.linkType = linkType; stroke.addStylusPointsToLink(); // dotted if (stroke.style.type == 1) { stroke.DrawingAttributes.Color = Colors.Transparent; } else // normal line { stroke.DrawingAttributes.Color = (Color)ColorConverter.ConvertFromString(selectedColor); } stroke.DrawingAttributes.Width = stroke.getThickness(); stroke.DrawingAttributes.Height = stroke.getThickness(); StrokeCollection sc = new StrokeCollection(); sc.Add(stroke); DrawingService.UpdateLinks(sc); surfaceDessin.RefreshChildren(); } IsEnabled = true; }