Exemple #1
0
        /// <summary>
        /// Call to stop receiving DeviceChanged event notifications.
        /// </summary>
        /// <param name="watcher"></param>
        public void UnRegisterForDeviceChangeNotification(DeviceChangeWatcherArgs watcher)
        {
            if (watcher == null)
            {
                throw new ArgumentNullException("watcher");
            }

            lock (_TheLock)
            {
                _DeviceChangeCallbackList.Remove(watcher);
            }
        }
Exemple #2
0
        /// <summary>
        /// Allows users of DeviceManager to stipulate which device change notifications will get sent. Users that
        /// subscribe directly to the DeviceChanged event will get all notifications identified by NotifyFilters.Any.
        /// Call UnRegisterForDeviceChangeNotification() to stop receiving DeviceChanged event notifications.
        /// </summary>
        /// <param name="watcher"></param>
        public void RegisterForDeviceChangeNotification(DeviceChangeWatcherArgs watcher)
        {
            if (watcher == null)
            {
                throw new ArgumentNullException("watcher");
            }

            lock (_TheLock)
            {
                if (!_DeviceChangeCallbackList.Contains(watcher))
                {
                    _DeviceChangeCallbackList.Add(watcher);
                }
            }
        }