private void MyDrawObject_DrawComplete(object sender, DrawEventArgs args)
        {
            MyDrawObject.IsEnabled = false;

            resultsLayer.ClearGraphics();

            Polyline polyline = args.Geometry as Polyline;

            polyline.SpatialReference = MyMap.SpatialReference;

            geometryService =
                new GeometryService("http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer");
            geometryService.TrimExtendCompleted += GeometryService_TrimExtendCompleted;
            geometryService.Failed += GeometryService_Failed;

            List <Polyline> polylineList = new List <Polyline>();

            foreach (Graphic g in polylineLayer.Graphics)
            {
                polylineList.Add(g.Geometry as Polyline);
            }

            geometryService.TrimExtendAsync(polylineList, polyline, CurveExtension.DefaultCurveExtension);
        }
        private void MyDrawObject_DrawComplete(object sender, DrawEventArgs args)
        {
            MyDrawObject.IsEnabled = false;

            resultsLayer.ClearGraphics();

            Polyline polyline = args.Geometry as Polyline;
            polyline.SpatialReference = MyMap.SpatialReference;

            geometryService =
            new GeometryService("http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer");
            geometryService.TrimExtendCompleted += GeometryService_TrimExtendCompleted;
            geometryService.Failed += GeometryService_Failed;

            List<Polyline> polylineList = new List<Polyline>();
            foreach (Graphic g in polylineLayer.Graphics)
                polylineList.Add(g.Geometry as Polyline);

            geometryService.TrimExtendAsync(polylineList, polyline, CurveExtension.DefaultCurveExtension);
        }