예제 #1
0
 /* added -> */
 public void Dispose()
 {
     if (_notificationClient != null)
     {
         int hr = _realEnumerator.UnregisterEndpointNotificationCallback(_notificationClient);
         Marshal.ThrowExceptionForHR(hr);
         _notificationClient = null;
     }
     if (_realEnumerator != null)
     {
         Marshal.ReleaseComObject(_realEnumerator);
     }
 }
예제 #2
0
        public MMDeviceEnumerator()
        {
            if (System.Environment.OSVersion.Version.Major < 6)
            {
                throw new NotSupportedException("This functionality is only supported on Windows Vista or newer.");
            }

            /* added -> */
            _notificationClient = new MMNotificationClient(this);
            int hr = _realEnumerator.RegisterEndpointNotificationCallback(_notificationClient);
            Marshal.ThrowExceptionForHR(hr);
            /* <- added */
        }
예제 #3
0
        public MMDeviceEnumerator()
        {
            if (System.Environment.OSVersion.Version.Major < 6)
            {
                throw new NotSupportedException("This functionality is only supported on Windows Vista or newer.");
            }

            /* added -> */
            _notificationClient = new MMNotificationClient(this);
            int hr = _realEnumerator.RegisterEndpointNotificationCallback(_notificationClient);

            Marshal.ThrowExceptionForHR(hr);
            /* <- added */
        }
예제 #4
0
 /* added -> */
 public void Dispose()
 {
     if (_notificationClient != null)
     {
         int hr = _realEnumerator.UnregisterEndpointNotificationCallback(_notificationClient);
         Marshal.ThrowExceptionForHR(hr);
         _notificationClient = null;
     }
     if (_realEnumerator != null) Marshal.ReleaseComObject(_realEnumerator);
 }