protected override void Dispose(bool disposing) { if (disposing) { if (NativeCGImage != null) { NativeCGImage.Dispose(); NativeCGImage = null; } if (dataProvider != null) { dataProvider.Dispose(); dataProvider = null; } if (imageSource != null) { imageSource.Dispose(); imageSource = null; } } base.Dispose(disposing); }