Initialization

Call AgRtGlobals.Initialize in order to initialize the RT3 framework. You can then create and use the AgStkBroker object. It is a singleton, so creating several instances of it will always access the same data.

using AGI.Realtime;
AgRtGlobals m_RtGlobals = new AgRtGlobals();
m_RtGlobals.Initialize();

External Automation

If using STK via external automation, you can access the STK Object Model Broker by creating it using the CreateObject method. Since the STK Object Model Broker is a singleton, the same version of the STK Object Model Broker being used inside of the STK process will be returned to you.

object StkApplication = Marshal.GetActiveObject("STK11.Application");
AgStkBroker Broker =
StkApplication.GetType().InvokeMember("CreateObject",
BindingFlags.InvokeMethod, null, StkApplication, new object[] {
"AgStkBroker9.AgStkBroker" }) as AgStkBroker;

The same holds true for automating the RT3 module in STK.

object StkApplication = Marshal.GetActiveObject("STK11.Application");
AgRt3Application Rt3Application =
Rt3Application.GetType().InvokeMember("CreateObject",
BindingFlags.InvokeMethod, null, Rt3Application, new object[] {
"AgRt3_9.AgRt3Application" }) as AgRt3Application;

STK 11.2.1 Programming Interface