Open Cologler opened 11 months ago
The real problem is not all third-party components support cancel. For example you see the TextViewer can be cancelled, but the ImageViewer can't. In this case it's because the ImageViewer does not provide a way to stop loading an image.
Another problem we have is the UI thread. WPF limits visual elements to run in the UI thread, will will effectively block the whole application.
If you have a better idea please let me know. I ran out of idea.
It looks like the ImageViewer
was loading the image in an async task:
Replace Image.FromFile
to Image.FromStream
and replace BitmapImage.UriSource
to BitmapImage.StreamSource
should allow us to cancel the IO operator:
Currently, previewing a big file is not cancellable. QuickLook may crash if I jump too fast.
Add the new async plugin interface with
CancellationToken
, which allows the user to cancel the current operator.