/// <summary> /// The main entry point for the application. /// </summary> static void Main() { OutProc outProc = new OutProc(); try { outProc.CreateOpcClient(); OpcClient opcClient = outProc.OpcClient; // initialize the client instance if (!ResultCode.SUCCEEDED(opcClient.Initialize())) { opcClient = null; return; } // end if OpcForm opcForm = new OpcForm(outProc); System.Windows.Forms.Application.Run(opcForm); opcClient.Terminate(); opcClient = null; } catch (Exception exc) { MessageBox.Show(exc.ToString()); } // end try...catch } // end Main
public OpcForm(OutProc anOutProc) { InitializeComponent(); try { m_outProc = anOutProc; m_opcClient = m_outProc.OpcClient; } catch (Exception exc) { MessageBox.Show(exc.ToString()); } // end try...catch } // end constructor