} // end Terminate public int InitializeAeObjects() { int connectResult = (int)EnumResultCode.E_FAIL; m_executionOptions = new ExecutionOptions(); m_executionOptions.ExecutionContext = 0; m_sourcePath = "computer.clock.time slot 1"; try { m_aeSession = new MyAeSession("opcae:///Softing.OPCToolboxDemo_ServerAE.1/{2E565243-B238-11D3-842D-0008C779D775}"); connectResult = m_aeSession.Connect( true, false, m_executionOptions); } catch (Exception exc) { GetApplication().Trace( EnumTraceLevel.ERR, EnumTraceGroup.USER, "OpcClient::InitializeAeObjects", exc.ToString()); } // end try...catch return(connectResult); } // end InitializeAeObjects
} // end ProcessCommandLine public void Terminate() { if (m_aeSession.CurrentState != EnumObjectState.DISCONNECTED) { m_aeSession.Disconnect(m_executionOptions); } GetApplication().RemoveAeSession(m_aeSession); GetApplication().Terminate(); m_aeSession = null; m_executionOptions = null; } // end Terminate