public void Dispose() { if (ImageBitmap != null) { ImageBitmap.Dispose(); ImageBitmap = null; } }
private static void CleanupBitmapMemory() { if (ImageBitmap != null) { ImageBitmapCleanup?.Invoke(null, EventArgs.Empty); // Recycle and Dispose the bitmap if (!ImageBitmap.IsRecycled) { ImageBitmap.Recycle(); } ImageBitmap.Dispose(); ImageBitmap = null; } if (ImageOptions != null) { ImageOptions.Dispose(); ImageBitmap = null; } }