STK UI CoreSend comments on this topic.
GetServiceByName Method (IAgUiWindow)
See Also
Name
Windows





Windows & Linux

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
);
[Unmanaged C++]
public: HRESULT GetServiceByName(
    BSTR Name,
    IUnknown ** ppRetVal
);
[Java]
public Object getServiceByName(
    String Name
);
[Python - STK API ]
def GetServiceByName(self, Name:str) -> "IUnknown":

Parameters

Name

See Also

Example

Enumerate all 3D (Globe) windows by name and print their scene identifiers.
[C#]
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 by name and print their map identifiers.
[C#]
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 by name and print their scene identifiers.
[Visual Basic .NET]
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 by name and print their map identifiers.
[Visual Basic .NET]
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
© 2024 Analytical Graphics, Inc. All Rights Reserved.