简体   繁体   中英

C# WPF: Loading data from dynamically generated image files

I am wondering how I can load information from dynamically generated files?

For example: There will be 20 images generated every 10 seconds; Image files are going to be save under D:\\ drive , something like:

D:\image1.tif is generated at 1s, 
D:\image2.tif is generated at 11s and
D:\image3.tif is generated at 21s, 

and so on so forth.

Then once a new image is generated, I want to load some information, a pixel intensity for instance, from the image immediately. But I want to do that after the generation of the image is complete.

Then I am going to display the information I just retrieved to my WPF form.

So what is the best way to do this?

The filesystem changes can be monitored using FileSystemWatcher Class . Of course, you can implement some simpler filesystem change detection mechanism by polling (retrieving the listing) the certain filesystem directory by yourself.

So, when a filesystem change is detected, load the info about the file and display it.

Update:

Yes, to detect whether file modification is completed (periodically trying to open the file), please take a look at the question: FileSystemWatcher triggers for filestream open .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM