This document is archived and information here might be outdated.  Recommended version.


IEditSketchExtension2.Applies Method (ArcObjects .NET 10.8 SDK)
ArcObjects Help for .NET developers > ArcObjects Help for .NET developers > ArcObjects namespaces > Editor > ESRI.ArcGIS.Editor > Interfaces > IE > IEditSketchExtension2 Interface > IEditSketchExtension2.Applies Method
ArcGIS Developer Help

IEditSketchExtension2.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

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