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 | Editor Class | IEditTask.OnFinishSketch Method | IEditor Interface | IEditTask.OnDeleteSketch Method | IEditTask.Activate Method | IEditTask.Deactivate Method | IEditSketch Interface | IEditAttributeProperties Interface | IEditLayers Interface | IEditEvents Interface | IEditTask.Name Property | IEditProperties Interface | IEditEvents2 Interface | ISnapEnvironment Interface | IExtension Interface