AGI Ui Core 11 Send comments on this topic.
GetServiceByType Method (IAgUiWindow)
See Also  Example
ServiceType





Description

Returns a service object that can be accessed at runtime. The method returns null if no service object is associated with the specified service type.

Syntax

[Visual Basic .NET]
Public Function GetServiceByType( _
   ByVal ServiceType As AgEWindowService _
) As Object

[C#]
public Object GetServiceByType(
AgEWindowService ServiceType
);

[Managed C++]
public: IUnknown^ GetServiceByType(
AgEWindowService ServiceType
);

[Java]
public Object getServiceByType(
AgEWindowService ServiceType
);

[Unmanaged C++]
public: HRESULT GetServiceByType(
AgEWindowService ServiceType,
IUnknown ** ReturnValue
);

Parameters

ServiceType
Member Value Description
eWindowService2DWindow 1 A 2D window.
eWindowService3DWindow 2 A 3D window.

Example

Enumerate all 3D (Globe) windows and print their scene identifiers.
[C#] Copy Code
foreach (IAgUiWindow window in application.Windows) 

    object oSvc = window.GetServiceByType(AgEWindowService.eWindowService3DWindow); 
    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.GetServiceByType(AgEWindowService.eWindowService2DWindow); 
    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.GetServiceByType(AgEWindowService.eWindowService3DWindow)
    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.GetServiceByType(AgEWindowService.eWindowService2DWindow)
    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

© 2016 Analytical Graphics, Inc. All Rights Reserved.

STK Programming Interface 11.0.1