Nick Tsui
Nick Tsui

Reputation: 634

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?

Upvotes: 0

Views: 274

Answers (1)

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.

Upvotes: 1

Related Questions