/// <summary> /// This method updates the route polyline, especially by providing a new geometry. /// The DragAndDrop handling is corrected. /// </summary> /// <param name="points">Points defining the new geometry for the polyline.</param> /// <param name="toolTip">Tool tip of the hole polyline.</param> /// <param name="style">Display style of the polyline.</param> public void Update(IEnumerable <Point> points, string toolTip, ShapeStyle style) { if (route != null && !PointsExists()) { // remove drag and drop behavior InProcessDragDropBehavior.RemoveDragHandler(MapPolyline, Drag); InProcessDragDropBehavior.SetEnableDragDrop(MapPolyline, true); InProcessDragDropBehavior.RemoveDragHandler(AnimatedPolyline, Drag); InProcessDragDropBehavior.SetEnableDragDrop(AnimatedPolyline, true); } Dispose(); Points = points; ToolTip = toolTip; Color = style == null ? Colors.Black : style.Color; if (route == null || PointsExists()) { return; } // add drag and drop behavior InProcessDragDropBehavior.SetEnableDragDrop(MapPolyline, true); InProcessDragDropBehavior.AddDragHandler(MapPolyline, Drag); InProcessDragDropBehavior.SetEnableDragDrop(AnimatedPolyline, true); InProcessDragDropBehavior.AddDragHandler(AnimatedPolyline, Drag); }
/// <summary> /// Disposes the way point. /// </summary> public virtual void Dispose() { WayPointMouseRightButtonDown -= WayPoint_MouseRightButtonDown; InProcessDragDropBehavior.SetEnableDragDrop(this, false); InProcessDragDropBehavior.RemoveDragHandler(this, Drag); InProcessDragDropBehavior.RemoveDragMoveHandler(this, DragMove); layer.Shapes.Remove(this); }