示例#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

                OpcForm opcForm = new OpcForm();

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

                opcClient.SetForm(opcForm);

                opcForm.SetOutProc(outProc);
                System.Windows.Forms.Application.Run(opcForm);

                opcClient.Terminate();
                opcClient = null;
            }
            catch (Exception exc)
            {
                MessageBox.Show(exc.ToString());
            }       //	end try...catch
        }           //	end Main
        //--
        #endregion

        //--
        #endregion

        #region Public Methods
        //---------------------

        public void SetForm(OpcForm form)
        {
            m_opcForm = form;
        }
示例#3
0
        }           //	end InitializeAeObjects

        public void SetForm(OpcForm form)
        {
            m_opcForm = form;
            m_aeSession.SetForm(m_opcForm);
            m_aeSubscription.SetForm(m_opcForm);
        }