Dominque,Thanks for the reply. O.K. what you told me is along the lines of what I was thinking. So I'm trying to create a task that accepts a Polygon or muilitiple polygons for the input. At the end of this post you will find the Parameter from my endpoint.I have created a button that triggers the polygon creation:
private void CreateGeoPoly_Click(object sender, RoutedEventArgs e)
{
//Gives users ability to draw poly
MyDrawObject = new Draw(Map)
{
DrawMode = DrawMode.Polygon,
IsEnabled = true,
FillSymbol = LayoutRoot.Resources["ClipFeaturesFillSymbol"] as ESRI.ArcGIS.Client.Symbols.FillSymbol
};
//Start MyDrawObject_DrawComplete, which turns the drawn poly into a graphic
MyDrawObject.DrawComplete += MyDrawObject_DrawComplete;
}
Have the polygon is created I'm using the DrawEventArgs complete to create the graphic, if the user wants to create another polygon she/he can just hit the CreateGeoPoly icon/button and create another and another and etc.
private void MyDrawObject_DrawComplete(object sender, DrawEventArgs args)
{
//Disable the drawing tool
MyDrawObject.IsEnabled = false;
//Start processing time bar
ProcessingTextBlock.Visibility = Visibility.Visible;
_processingTimer.Start();
//Assign the graphic draw to a graphiclayer, the graphic layer is defined in xaml
GraphicsLayer graphicsLayer = Map.Layers["MyGraphicsLayer"] as GraphicsLayer;
//Ready the graphic to assign the graphic to the parameter
Graphic graphic = new Graphic()
{
Symbol = LayoutRoot.Resources["ClipFeaturesFillSymbol"] as ESRI.ArcGIS.Client.Symbols.FillSymbol,
Geometry = args.Geometry
};
//add graphic
graphicsLayer.Graphics.Add(graphic);
}
My thought is, now when the user wants to run the process I've created a simple start/run button but as you can see it errors out because of parameter "args.Geometry" was declared in the last method (private void MyDrawObject_DrawComplete). I'm having trouble figuring out what I need to swap out with args.Geometry maybe something like a referrence to my created graphicslayer geometry? Is this something I can do, is it possible? Or should I some how take the route If your number of input geometry is not defined you can also consider to use a FeatureSetLayer as input.
I guess I'm not sure if my input geometry is defined or not?
private void RunGeoPolyButton_Click(object sender, RoutedEventArgs e)
{
//Declare GP Task and URL
Geoprocessor geoprocessorTask = new Geoprocessor("http://servername/ArcGIS/rest/services/GPServer/CreatePoly");
geoprocessorTask.UpdateDelay = 5000;
//When Task Completes call method GeoprocessorTask_JobCompleted
geoprocessorTask.JobCompleted += GeoprocessorTask_JobCompleted;
//Input Parameters
List<GPParameter> parameters = new List<GPParameter>();
parameters.Add(new GPFeatureRecordSetLayer("Draw_Polygon", args.Geometry));
geoprocessorTask.SubmitJobAsync(parameters);
Parameter: Draw_PolygonData Type: GPFeatureRecordSetLayerDisplay Name: Draw a polygon or multiple polygons.Direction: esriGPParameterDirectionInputDefault Value: Geometry Type: esriGeometryPolygonSpatial Reference: 4326Fields: OBJECTID (Type: esriFieldTypeOID, Alias: OBJECTID) SHAPE (Type: esriFieldTypeGeometry, Alias: SHAPE) SHAPE_Length (Type: esriFieldTypeDouble, Alias: SHAPE_Length) SHAPE_Area (Type: esriFieldTypeDouble, Alias: SHAPE_Area) Parameter Type: esriGPParameterTypeOptionalCategory:Thanks for you time and help.Dave