Select to view content in your preferred language

Leading an editor widget edit into a second editing action

758
4
07-25-2012 06:07 AM
JaredWhite
Regular Contributor
Hi,

I'm trying to try and have an edit from the template picker lead into a second edit of a different type (well cap at surface into it's lateral). But I'm having trouble with the syntax and available methods. Can anyone help me on this?

My code so far reads as follows.

        private void EditorWidget_EditCompleted(object sender, Editor.EditEventArgs e)
        {
            FeatureLayer horizontalWellCap = TabletMap.Layers["1"] as FeatureLayer;
            FeatureLayer horizontalwellLateral = TabletMap.Layers["2"] as FeatureLayer;

            if (e.Action == Editor.EditAction.Add)
            {
                foreach (Editor.Change change in e.Edits)
                {
                    if (change.Layer != null && change.Layer == horizontalWellCap && change.Graphic != null)
                    {
                    }
                }
            }
        }
0 Kudos
4 Replies
JaredWhite
Regular Contributor
Does anyone have any suggestions?
0 Kudos
PreetiMaske
Esri Regular Contributor
If I understood it right, you are trying to initiate another edition action when condition in EditorWidget_EditCompleted is true. If that's correct then changing the editor action is not exposed via EditorWidget. You need more granular control on edit actions and hence should use Editor which is more granular.

Something like this...

Also see sample in link below on how to set up Editor
http://resources.arcgis.com/en/help/silverlight-api/samples/start.htm#EditToolsExplicitSave

void editor_EditCompleted(object sender,Editor.EditEventArgs e)
{
  FeatureLayer horizontalWellCap = TabletMap.Layers["1"] as FeatureLayer;
            FeatureLayer horizontalwellLateral = TabletMap.Layers["2"] as FeatureLayer;

            if (e.Action == Editor.EditAction.Add)
            {
                foreach (Editor.Change change in e.Edits)
                {
                    if (change.Layer != null && change.Layer == horizontalWellCap && change.Graphic != null)
                    {
                                 if (editor.Select.CanExecute("new"))
   editor.Select.Execute("new");
                    }
                }
            }
}

Hope this helps..
0 Kudos
JaredWhite
Regular Contributor
Hi, I adapted your suggestion but I'm still not getting a second edit action.


private void EditorWidget_EditCompleted(object sender, Editor.EditEventArgs e)
{
    FeatureLayer horizontalWellCap = TabletMap.Layers["2"] as FeatureLayer;
    FeatureLayer horizontalwellLateral = TabletMap.Layers["5"] as FeatureLayer;            
    if (e.Action == Editor.EditAction.Add)
    {

       foreach (Editor.Change change in e.Edits)
       {
           if (change.Layer != null && change.Layer 
                    == horizontalWellCap && change.Graphic != null)
           {
                Editor editor = new Editor();
                editor.GeometryServiceUrl = 
                    "http://10.100.100.9:6080/arcgis/rest/services/Utilities/Geometry/GeometryServer";
                editor.Map = TabletMap;
                string[] layerIDs = { "5" };                        
                editor.LayerIDs = layerIDs;
                if (editor.Select.CanExecute("new"))
                editor.Select.Execute("new");
            }
        }
    }
}

0 Kudos
PreetiMaske
Esri Regular Contributor
The workflow in your sample seems bit off.. In your case you will have to eliminate EditorWidget from the equation and craft your own editing toolbar using Editor. For help on this refer to sample link below:
http://resources.arcgis.com/en/help/silverlight-api/samples/start.htm#EditToolsExplicitSave


You may also use TemplatePicker for ease of adding features. I have done a small sample just to give you an idea on how you can achieve this. Please note code attached is for demonstration purpose only. To use sample add a polygon using Templatepicker, when add is completed, you may click on another feature which will select them. That happens because when Add is complete I execute Select action.
For editor you don't have to set layerids or Map everytime to wish to start a new action. This should  be done once. If no layerIds are specified Editor works on all editable layers in the map. To limit editor to work on specific layers layerids must be specified.

I hope this helps. Please let me know if you have any questions.

--Preeti
0 Kudos