} // end ProcessCommandLine public void Terminate() { if (m_aeSession.CurrentState != EnumObjectState.CONNECTED) { m_aeSession.Disconnect(null); } GetApplication().RemoveAeSession(m_aeSession); GetApplication().Terminate(); m_aeSession = null; } // end Terminate
} // end Terminate public int InitializeAeObjects() { int connectResult = (int)EnumResultCode.E_FAIL; try { m_aeSession = new MyAeSession("opcae:///Softing.OPCToolboxDemo_ServerAE.1/{2E565243-B238-11D3-842D-0008C779D775}"); connectResult = m_aeSession.Connect(true, false, new ExecutionOptions()); } catch (Exception exc) { GetApplication().Trace( EnumTraceLevel.ERR, EnumTraceGroup.USER, "OpcClient::InitializeAeObjects", exc.ToString()); } // end try...catch return(connectResult); } // end InitializeAeObjects
public OpcForm(OutProc anOutProc) { InitializeComponent(); try { m_executionOptions = new ExecutionOptions(); m_outProc = anOutProc; m_opcClient = m_outProc.OpcClient; m_session = m_opcClient.getSession(); TreeNode treeRoot = new TreeNode(m_session.Url + " - Area space", 0, 0); addressSpaceTreeView.Nodes.Add(treeRoot); treeRoot.Nodes.Add(new TreeNode("")); } catch (Exception exc) { MessageBox.Show(exc.ToString()); } // end try...catch } // end constructor