Description
Returns a service object that can be accessed
at runtime. The method returns null if no service object is
associated with the specified symbolic name.
Syntax
[Visual Basic .NET] |
Public Function GetServiceByName( _
ByVal Name As String _
) As Object
|
[C#] |
public Object GetServiceByName(
string Name
);
|
[Managed C++] |
public: IUnknown^ GetServiceByName(
String __gc ^ Name
);
|
[Java] |
public Object getServiceByName(
String Name
);
|
[Unmanaged C++] |
public: HRESULT GetServiceByName(
BSTR Name,
IUnknown ** ReturnValue
);
|
Parameters
Example
Enumerate all 3D
(Globe) windows and print their scene identifiers.
[C#] |
Copy Code
|
foreach (IAgUiWindow window in application.Windows)
{
object oSvc = window.GetServiceByName("Globe");
IAgUiWindowGlobeObject globeObject = oSvc as IAgUiWindowGlobeObject;
if (globeObject != null)
{
Console.WriteLine("Window Title: {0}, scene ID: {1}", window.Caption, globeObject.SceneID);
}
}
|
|
Enumerate all 2D
(Map) windows and print their map identifiers.
[C#] |
Copy Code
|
foreach (IAgUiWindow window in application.Windows)
{
object oSvc = window.GetServiceByName("Map");
IAgUiWindowMapObject mapObject = oSvc as IAgUiWindowMapObject;
if (mapObject != null)
{
Console.WriteLine("Window Title: {0}, scene ID: {1}", window.Caption, mapObject.MapID);
}
}
|
|
Enumerate all 3D
(Globe) windows and print their scene identifiers.
[Visual Basic .NET] |
Copy Code
|
For Each window
As IAgUiWindow In application.Windows
Dim oSvc
As Object
= window.GetServiceByName("Globe")
Dim
globeObject As IAgUiWindowGlobeObject
= TryCast(oSvc, IAgUiWindowGlobeObject)
If globeObject
IsNot Nothing Then
Console.WriteLine("Window
Title: {0}, scene ID: {1}", window.Caption,
globeObject.SceneID)
End
If
Next
|
|
Enumerate all 2D
(Map) windows and print their map identifiers.
[Visual Basic .NET] |
Copy Code
|
For Each window
As IAgUiWindow In application.Windows
Dim oSvc
As Object
= window.GetServiceByName("Map")
Dim mapObject
As IAgUiWindowMapObject =
TryCast(oSvc, IAgUiWindowMapObject)
If mapObject
IsNot Nothing Then
Console.WriteLine("Window
Title: {0}, scene ID: {1}", window.Caption,
mapObject.MapID)
End
If
Next
|
|
See Also