CreateEventSubscription() public method

Creates an event subscription.
public CreateEventSubscription ( ) : IOPCEventSubscriptionMgt
return IOPCEventSubscriptionMgt
コード例 #1
0
        /// <summary>
        /// Creates the subscription.
        /// </summary>
        public void Create()
        {
            ComAeClient client = m_manager.SelectClient(m_defaultContext, false);

            // release existing server.
            if (this.Unknown != null)
            {
                ReleaseServer();
            }

            // create the subscription.
            this.Unknown = client.CreateEventSubscription();

            // select the attributes.
            foreach (KeyValuePair <int, int[]> entry in m_cache.Attributes)
            {
                SelectReturnedAttributes(entry.Key, entry.Value);
            }

            // set the filter.
            SetFilter(m_qualifiedName, m_isSource);

            // set up callback.
            try
            {
                m_callback = new ComAeEventSink(this);
            }
            catch (Exception e)
            {
                Utils.Trace("Could not establish event callback.", e);
            }
        }