예제 #1
0
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        static void Main()
        {
            OutProc outProc = new OutProc();
            int     result  = (int)EnumResultCode.S_OK;

            try
            {
                outProc.CreateOpcClient();
                OpcClient opcClient = outProc.OpcClient;

                //	initialize the client instance
                if (!ResultCode.SUCCEEDED(opcClient.Initialize()))
                {
                    opcClient = null;
                    return;
                }                   //	end if

                //	initialize the AE client simulation
                result |= opcClient.InitializeAeObjects();

                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
예제 #2
0
        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