public ManagementEventWatcher(ManagementScope scope, EventQuery query, EventWatcherOptions options)
 {
     if (scope != null)
     {
         this.scope = ManagementScope._Clone(scope, new IdentifierChangedEventHandler(this.HandleIdentifierChange));
     }
     else
     {
         this.scope = ManagementScope._Clone(null, new IdentifierChangedEventHandler(this.HandleIdentifierChange));
     }
     if (query != null)
     {
         this.query = (EventQuery) query.Clone();
     }
     else
     {
         this.query = new EventQuery();
     }
     this.query.IdentifierChanged += new IdentifierChangedEventHandler(this.HandleIdentifierChange);
     if (options != null)
     {
         this.options = (EventWatcherOptions) options.Clone();
     }
     else
     {
         this.options = new EventWatcherOptions();
     }
     this.options.IdentifierChanged += new IdentifierChangedEventHandler(this.HandleIdentifierChange);
     this.enumWbem = null;
     this.cachedCount = 0;
     this.cacheIndex = 0;
     this.sink = null;
     this.delegateInvoker = new WmiDelegateInvoker(this);
 }
Example #2
0
 public ManagementEventWatcher(ManagementScope scope, EventQuery query, EventWatcherOptions options)
 {
     if (scope != null)
     {
         this.scope = ManagementScope._Clone(scope, new IdentifierChangedEventHandler(this.HandleIdentifierChange));
     }
     else
     {
         this.scope = ManagementScope._Clone(null, new IdentifierChangedEventHandler(this.HandleIdentifierChange));
     }
     if (query != null)
     {
         this.query = (EventQuery)query.Clone();
     }
     else
     {
         this.query = new EventQuery();
     }
     this.query.IdentifierChanged += new IdentifierChangedEventHandler(this.HandleIdentifierChange);
     if (options != null)
     {
         this.options = (EventWatcherOptions)options.Clone();
     }
     else
     {
         this.options = new EventWatcherOptions();
     }
     this.options.IdentifierChanged += new IdentifierChangedEventHandler(this.HandleIdentifierChange);
     this.enumWbem        = null;
     this.cachedCount     = 0;
     this.cacheIndex      = 0;
     this.sink            = null;
     this.delegateInvoker = new WmiDelegateInvoker(this);
 }
        /// <summary>
        ///    <para>Creates a new watcher that will listen for events conforming to the given WMI
        ///       event query, in the given WMI scope, and according to the specified options. For
        ///       this variant the query and the scope are specified objects. The options object
        ///       specifies options such as a timeout and possibly context information.</para>
        /// </summary>
        public ManagementEventWatcher(
            ManagementScope scope,
            EventQuery query,
            EventWatcherOptions options)
        {
            if (null != scope)
            {
                Scope = scope;
            }
            else
            {
                Scope = new ManagementScope();
            }

            if (null != query)
            {
                Query = query;
            }
            else
            {
                Query = new EventQuery();
            }

            if (null != options)
            {
                Options = options;
            }
            else
            {
                Options = new EventWatcherOptions();
            }

            enumWbem        = null;
            cachedCount     = 0;
            cacheIndex      = 0;
            sink            = null;
            delegateInvoker = new WmiDelegateInvoker(this);
        }
		public ManagementOperationObserver()
		{
			this.m_sinkCollection = new Hashtable();
			this.delegateInvoker = new WmiDelegateInvoker(this);
		}
 /// <summary>
 /// <para>Initializes a new instance of the <see cref='System.Management.ManagementOperationObserver'/> class. This is the default constructor.</para>
 /// </summary>
 public ManagementOperationObserver()
 {
     // We make our sink collection synchronized
     m_sinkCollection = new Hashtable();
     delegateInvoker  = new WmiDelegateInvoker(this);
 }
 /// <summary>
 /// <para>Initializes a new instance of the <see cref='System.Management.ManagementOperationObserver'/> class. This is the default constructor.</para>
 /// </summary>
 public ManagementOperationObserver () 
 {
     // We make our sink collection synchronized
     m_sinkCollection = new Hashtable ();
     delegateInvoker = new WmiDelegateInvoker (this);
 }
        /// <summary>
        /// <para> Initializes a new instance of the <see cref='System.Management.ManagementEventWatcher'/> class 
        ///    that listens for events conforming to the given WMI event query, according to the specified
        ///    options. For this variant, the query and the scope are specified objects. The
        ///    options object can specify options such as timeout and context information.</para>
        /// </summary>
        /// <param name='scope'>A <see cref='System.Management.ManagementScope'/> object representing the scope (namespace) in which the watcher will listen for events.</param>
        /// <param name=' query'>An <see cref='System.Management.EventQuery'/> object representing a WMI event query, which determines the events for which the watcher will listen.</param>
        /// <param name='options'>An <see cref='System.Management.EventWatcherOptions'/> object representing additional options used to watch for events. </param>
        public ManagementEventWatcher(
            ManagementScope scope, 
            EventQuery query, 
            EventWatcherOptions options)
        {
            if (null != scope)
                this.scope = ManagementScope._Clone(scope, new IdentifierChangedEventHandler(HandleIdentifierChange));
            else
                this.scope = ManagementScope._Clone(null, new IdentifierChangedEventHandler(HandleIdentifierChange));

            if (null != query)
                this.query = (EventQuery)query.Clone();
            else
                this.query = new EventQuery();
            this.query.IdentifierChanged += new IdentifierChangedEventHandler(HandleIdentifierChange);

            if (null != options)
                this.options = (EventWatcherOptions)options.Clone();
            else
                this.options = new EventWatcherOptions();
            this.options.IdentifierChanged += new IdentifierChangedEventHandler(HandleIdentifierChange);

            enumWbem = null;
            cachedCount = 0; 
            cacheIndex = 0;
            sink = null;
            delegateInvoker = new WmiDelegateInvoker (this);
        }
 public ManagementOperationObserver()
 {
     this.delegateInvoker = new WmiDelegateInvoker(this);
 }
 public ManagementOperationObserver()
 {
     this.delegateInvoker = new WmiDelegateInvoker(this);
 }
 public ManagementOperationObserver()
 {
     this.m_sinkCollection = new Hashtable();
     this.delegateInvoker  = new WmiDelegateInvoker(this);
 }