private static MapPoint GetLastPoint(Geometry geometry) { MapPoint lastPoint = null; IEnumerable <PointCollection> pointCollections = null; if (geometry is Polygon) { pointCollections = ((Polygon)geometry).Rings; } else if (geometry is Polyline) { pointCollections = ((Polyline)geometry).Paths; } if (pointCollections != null) { PointCollection lastPointCollection = pointCollections.LastOrDefault(); if (lastPointCollection != null) { lastPoint = lastPointCollection.LastOrDefault(); } } return(lastPoint); }
public void UpdateLastPoint(Point point) { if (_points.Count > 1) { _points.Remove(_points.LastOrDefault()); } AddPoint(point); }