コード例 #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);
 }