artullman

Creating a local geometry service for use with editor control

Discussion created by artullman on Nov 17, 2011
Latest reply on Jan 23, 2012 by robert.zargarian@zettate
I found an examples shows how to edit polygons using the Editor class in online mode.  I need the same functionality in disconnected mode.  Since I want to use the autocomplete and other functionality, I need to use a geometry service with the editor.

Here is the samplecode in XAML for connected mode:

<esri:Editor x:Key="MyEditor"                         
                         LayerIDs="MyLayer"  
GeometryServiceUrl="http://tasks.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer"
                             />

I need to replace the remote geometry service with a local service for offline mode. 

I am not sure how to include a local geometry service in XAML, and I keep getting errors trying to create, start and reference the URL in code.  Whe I run the following code, it keeps telling me that local services are starting, so I can't start my localService.  Here the code, which I believe is correct, but I can't figure out when I can run it since I don't know when local service startup has completed.

LocalGeometryService  _localGeometryService = new LocalGeometryService();
_localGeometryService.Start();
ESRI.ArcGIS.Client.Editor myEditor = LayoutRoot.Resources["MyEditor"] as ESRI.ArcGIS.Client.Editor;
myEditor.GeometryServiceUrl = _localGeometryService.Url;

My question is:
1. How do I add a local geometry service to my Editor reference in XAML?
2. If I can't do it xaml, how do I do it in code?  Is there a point in the life cycle that I can create/start/reference the local geometry service without throwing an exception?

Thanks.

Outcomes