STK UI ApplicationSend comments on this topic.
IAgUiApplication Interface

Description

IAgUiApplication represents a root of the Application Model.

Public Methods

Public Method ActivateActivates the application's main window.
Public Method CreateApplicationCreate a new instance of the application model root object.
Public Method CreateObjectOnly works from local HTML pages and scripts.
Public Method DirectoryPickerDialogBrings up the Directory Picker Dialog and returns a selected directory name.
Public Method FileOpenDialogBrings up a common File Open dialog and returns the file name selected by the user. If the user canceled, returns an empty file name.
Public Method FileOpenDialogExtBrings up a standard File Open Dialog and returns an object representing the selected file.
Public Method FileSaveAsDialogBrings up a common File SaveAs dialog and returns the file name selected by the user. If the user canceled, returns an empty file name.
Public Method LoadPersonalityLoads a personality by its name.
Public Method LogMsgLogs the Message specified.
Public Method OpenLogFileSpecifies the current log file to be written to.
Public Method QuitShuts down the application.

Public Properties

Public Property DisplayAlertsSet to true to display certain alerts and messages. Otherwise false. The default value is True.
Public Property HeightGets/sets a height of the main window.
Public Property HWNDReturns an HWND handle associated with the application main window.
Public Property LeftGets/sets a vertical coordinate of the main window.
Public Property LogFileGets the current log files full path.
Public Property MessagePendingDelayGets/Sets message-pending delay for server busy dialog (in milliseconds).
Public Property MRUListReturns a collection most recently used files.
Public Property PathReturns the complete path to the application, excluding the final separator and name of the application. Read-only String.
Public Property PersonalityReturns a reference to the currently loaded personality.
Public Property Personality2Returns an new instance of the root object of the STK Object Model.
Public Property ProcessIDGets process id for the current instance.
Public Property TopGets/sets a horizontal coordinate of the main window.
Public Property UserControlGets/sets whether the application is user controlled.
Public Property VisibleGets/sets whether the main window is visible.
Public Property WidthGets/sets a width of the main window.
Public Property WindowsReturns a collection of windows.
Public Property WindowStateGets/sets the state of the main window.

Interfaces

Implemented Interface
IAgUiApplicationEvents

CoClasses that Implement IAgUiApplication

Example

Start STK and get a reference to IAgStkObjectRoot
[C#]
// Create an instance of STK
AgUiApplication uiApplication = new AgUiApplication();
uiApplication.LoadPersonality("STK");
uiApplication.Visible = true;

// Get our IAgStkObjectRoot interface
IAgStkObjectRoot stkRoot = uiApplication.Personality2 as IAgStkObjectRoot;
Get a reference to the AgStkObjectRoot using the running STK instance
[C#]
// Get reference to running STK instance
AgUiApplication uiApplication = System.Runtime.InteropServices.Marshal.GetActiveObject("STK12.Application") as AgUiApplication;

// Get our IAgStkObjectRoot interface
IAgStkObjectRoot stkRoot = uiApplication.Personality2 as IAgStkObjectRoot;
Get a reference to the AgStkObjectRoot with display alerts turned off.
[C#]
// Get reference to running STK instance
AgUiApplication uiApplication = System.Runtime.InteropServices.Marshal.GetActiveObject("STK12.Application") as AgUiApplication;

//Create a new instance of the application model root object. 
AgUiApplication uiApplication2 = uiApplication.CreateApplication() as AgUiApplication;
//Set DisplayAlerts to false to suppress certain alerts and messages.
//This is useful when automating tasks.
uiApplication2.DisplayAlerts = false;
// Get our IAgStkObjectRoot interface with display alerts turned off
IAgStkObjectRoot stkRoot = uiApplication2.Personality2 as IAgStkObjectRoot;
Start STK and get a reference to IAgStkObjectRoot
[Visual Basic .NET]
' Create an instance of STK
Dim uiApplication As New AgUiApplication()
uiApplication.LoadPersonality("STK")
uiApplication.Visible = True

' Get our IAgStkObjectRoot interface
Dim stkRoot As IAgStkObjectRoot = TryCast(uiApplication.Personality2, IAgStkObjectRoot)
Get a reference to the AgStkObjectRoot using the running STK instance
[Visual Basic .NET]
' Get reference to running STK instance
Dim uiApplication As AgUiApplication = TryCast(System.Runtime.InteropServices.Marshal.GetActiveObject("STK12.Application"), AgUiApplication)

' Get our IAgStkObjectRoot interface
Dim stkRoot As IAgStkObjectRoot = TryCast(uiApplication.Personality2, IAgStkObjectRoot)
Get a reference to the AgStkObjectRoot with display alerts turned off.
[Visual Basic .NET]
' Get reference to running STK instance
Dim uiApplication As AgUiApplication = TryCast(System.Runtime.InteropServices.Marshal.GetActiveObject("STK12.Application"), AgUiApplication)

'Create a new instance of the application model root object. 
Dim uiApplication2 As AgUiApplication = TryCast(uiApplication.CreateApplication(), AgUiApplication)

'Set DisplayAlerts to false to suppress certain alerts and messages.
'This is useful when automating tasks.
uiApplication2.DisplayAlerts = False

' Get our IAgStkObjectRoot interface with display alerts turned off
Dim stkRoot As IAgStkObjectRoot = TryCast(uiApplication2.Personality2, IAgStkObjectRoot)
Close STK
[Python - STK API]
# AgUiApplication uiApplication: STK Application
uiApplication.ShutDown()

© 2024 Analytical Graphics, Inc. All Rights Reserved.