Exemple #1
0
        public void Initialize()
        {
            if (m_SrvEx != null)
            {
                return; //Already initialized
            }
            Thread.CurrentThread.SetApartmentState(ApartmentState.STA);
            try {
                AgentServer AgSrv = new AgentServer();
                // The following cast does the QueryInterface to fetch IAgentEx interface from the IAgent interface, directly supported by the object
                m_SrvEx = (IAgentEx)AgSrv;

                m_Sink = new AgentNotifySink();
                m_Sink.Register(m_SrvEx);
            } catch (Exception e) {
                AgentServerStartupException ex = new AgentServerStartupException("Agent Server could not be started", e);
                Console.WriteLine(ex);
                throw ex;
            }
        }
Exemple #2
0
        public void Initialize()
        {
            if (m_SrvEx != null) {
                return; //Already initialized
            }
            Thread.CurrentThread.SetApartmentState(ApartmentState.STA);
            try {
                AgentServer AgSrv = new AgentServer();
                // The following cast does the QueryInterface to fetch IAgentEx interface from the IAgent interface, directly supported by the object
                m_SrvEx = (IAgentEx)AgSrv;

                m_Sink = new AgentNotifySink();
                m_Sink.Register(m_SrvEx);
            } catch (Exception e) {
                AgentServerStartupException ex = new AgentServerStartupException("Agent Server could not be started", e);
                Console.WriteLine(ex);
                throw ex;
            }
        }