public static void Main(String[] args) { try { int result = (int)EnumResultCode.S_OK; EndEvent = new AutoResetEvent(false); Console console = new Console(); MyWin32.HandlerRoutine handlerRoutine = new MyWin32.HandlerRoutine(MyWin32.Handler); MyWin32.SetConsoleCtrlHandler( handlerRoutine, true); console.CreateOpcClient(); // gets the OpcClient instance OpcClient client = console.OpcClient; // initialize the client instance if (!ResultCode.SUCCEEDED(client.Initialize())) { client = null; return; } // end if // initialize the DA client simulation result |= m_opcClient.InitializeDaObjects(); Usage(); bool end = false; while (!Console.End && !end) { String read = System.Console.ReadLine(); switch (read) { case "A": case "a": client.GetPropertiesAsync(); break; case "S": case "s": client.GetPropertiesSync(); break; case "E": case "e": case "Q": case "q": end = true; break; case "U": case "u": case "?": Usage(); break; } } // end while client.Terminate(); client = null; MyWin32.Handler(MyWin32.CtrlTypes.CTRL_CLOSE_EVENT); } catch (Exception exc) { System.Console.WriteLine(exc.ToString()); } // end try...catch } // end Main