/// <summary> /// Disconnect from device /// </summary> public void Disconnect() { if (!IsConnected) { return; } PortableDeviceClass.Unadvise(adviseCookie); eventCallback = null; IsConnected = false; }
private void Dispose(bool disposing) { if (disposing) { if (!string.IsNullOrEmpty(adviseCookie)) { PortableDeviceClass.Unadvise(adviseCookie); } if (IsConnected) { PortableDeviceClass.Close(); } } PortableDeviceClass = null; }