ESRI.ArcGIS.E2API Feedback via the User Forum
LayerResult Class
See Also  Members   Example 
ESRI.ArcGIS.E2API Namespace : LayerResult Class


Result representing a layer.

Object Model


Syntax

Visual Basic (Declaration) 
<ComVisibleAttribute(False)>
Public NotInheritable Class LayerResult 
   Inherits Result
Visual Basic (Usage)Copy Code
Dim instance As LayerResult
C# 
[ComVisibleAttribute(false)]
public sealed class LayerResult : Result 

Example

This example demonstrates how you can create a LayerResult and set its Layer property in the Execute method of a custom task class; in this case you should create the LayerResult, create a Layer without connecting it, and set the LayerResult.Layer property; as long as the AutoConnect property of the LayerResult is true, when the LayerResult is updated into the TaskContext then the layer will automatically be connected. In the code below it is assumed that there are parameters called Workspace and Dataset in the parameterset passed to the Execute method which determine the data that the new LayerResult is connected to; alternatively it may be typical for a Task to connect to a web service and retrieve the data to display for the LayerResult.
C#Copy Code
// Set up the Layer for the ResultLayer. 
ParameterSet parameters = taskContext.GetParameters(); // The TaskContext passed in to the Task.Execute method. 
LocalLayer newLayer = new LocalLayer(); // Create a new layer. 
newLayer.Workspace = parameters.GetParameter("Workspace") as string;  // Set the folder containing the data. 
newLayer.Dataset = parameters.GetParameter("Dataset") as string;  // Set the file name. 
         
// Set up the appearance of the result. 
LayerResult newResult = new LayerResult(); 
newResult.AutoConnect = true; // Ensure AutoConnect is true as we are creating this in the Task. 
newResult.Layer = newLayer; 
newResult.Title = newLayer.DisplayName + " LayerResult"; 
 
taskContext.UpdateResult(newResult); // Update the result; this will connect the layer.
Visual BasicCopy Code
' Set up the Layer for the ResultLayer.
Dim params As ParameterSet = taskContext.GetParameters() ' The TaskContext passed in to the Task.Execute method.
Dim newLayer As LocalLayer = New LocalLayer() ' Create a new layer.
newLayer.Workspace = parameters.GetParameter("Workspace") ' Set the folder containing the data.CType(As string,)
newLayer.Dataset = parameters.GetParameter("Dataset") ' Set the file name.CType(As string,)

' Set up the appearance of the result.
Dim newResult As LayerResult = New LayerResult()
newResult.AutoConnect = True ' Ensure AutoConnect is true as we are creating this in the Task.() As True
newResult.Layer = newLayer
newResult.Title = newLayer.DisplayName + " LayerResult"

taskContext.UpdateResult(newResult) ' Update the result; this will connect the layer.

Inheritance Hierarchy

System.Object
   ESRI.ArcGIS.E2API.Result
      ESRI.ArcGIS.E2API.LayerResult

Platforms

Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

Version Information

This class was added to the E2API at version 1.0.0.348.

See Also