ArcObjects Library Reference (Editor)  

IEditSketchExtension.Applies Method

Indicates whether this extension applies to the current edit environment.

[Visual Basic .NET]
Public Function Applies ( _
    ByVal Editor As IEditor _
) As Boolean
[C#]
public bool Applies (
    IEditor Editor
);

Product Availability

Available with ArcGIS Desktop.

Remarks

The ::Applies() method is called by the controller when attempting to determine if the extension applies or not.

If more than one class is found implementing IEditSketchExtension the current tool or task will utilize the first extension which ::Applies() returns VARIANT_TRUE.

[C#]

 if (task is ICreateFeatureTask)
  {
    //Creating new features
    IEditLayers editLayers = Editor as IEditLayers;
    if (editLayers.CurrentLayer.FeatureClass.ShapeType == esriGeometryType.esriGeometryPolygon)
      return true;
    else
      return false;
  }
  else if (task is IModifyTask)
    //Modifying existing feature
    return true;
  else
    return false;

[Visual Basic .NET]
 If TypeOf task Is ICreateFeatureTask Then
    'Creating new features
    Dim editLayers As IEditLayers =  TryCast(Editor, IEditLayers) 
    If editLayers.CurrentLayer.FeatureClass.ShapeType = esriGeomeTryType.esriGeomeTryPolygon Then
      Return True
    Else 
      Return False
    End If
 Else If TypeOf task Is IModifyTask Then 
    'Modifying existing feature
    Return True
 Else 
    Return False
 End If

See Also

IEditSketchExtension Interface | IDatasetEdit Interface | IDatasetEditInfo Interface | IEditTask.Name Property | Editor Class | ISnapEnvironment Interface | IEditEvents2 Interface | IEditTask.Deactivate Method | IEditAttributeProperties Interface | IEditor Interface | IEditSketch Interface | IEditTask.OnFinishSketch Method | IEditProperties Interface | IEditLayers Interface | IEditTask.Activate Method | IEditTask.OnDeleteSketch Method | IEditEvents Interface | IExtension Interface