Hi,I am using a geometry service's ProjectAsync method to project some graphics in an application, and I am passing the graphic layer name as a string using the userToken parameter:GeometryService ProjectShapefileService = new GeometryService(_geometryServiceUrl);
ProjectShapefileService.ProjectCompleted += ProjectShapefileService_ProjectCompleted;
ProjectShapefileService.Failed += ProjectShapefileService_Failed;
ProjectShapefileService.ProjectAsync(thisShapefileGraphics, _map.SpatialReference, shapefileName);
This works fine, except that when the project operation fails the UserState object that is returned via the Failed event (within the args object) does not match the type of the userToken parameter (in this case it is not a string). Instead it is a generic object array (see attached screenshot for debugging example).private void ProjectShapefileService_Failed(object sender, TaskFailedEventArgs args)
{
// This is what I need to do to get to the graphics layer name (passed via the userToken parameter)
object[] thisUserState = (args.UserState as object[])[0] as object[];
string thisShapefileName = thisUserState[2] as string;
// If this worked like other geometry service methods, I should be able to do this instead. Why not?
//string thisShapefileName = args.UserState as string;
Is there an easier way to get to the userToken parameter that was passed to the geometry service?Cheers,Andrew