C
C#•2mo ago
Cuda

How to update a listbox contents with a text file that is constantly being updated.

I've tried a streamreader and it doesn't update the listbox contents.
6 Replies
Cuda
Cuda•2mo ago
I'm using a backgroundWorker to attempt to do this.,
ffmpeg -i me -f null -
what is the mechanisms that updates the file? are you reading it via a watcher, or is it an append stream, or maybe events?
Cuda
Cuda•2mo ago
I'm not understanding the question. I'm just calling the StreamREader within a loop in a background worker. To update the text file that is supposed to show up in the listbox I just simply edit it with notepad to simulate and update to it. I'm doing that because I don't want to tie up the UI and also alow me to update the listbox. I hope I'm making sense. 😔
ffmpeg -i me -f null -
oh ok i thought it was more complex so is this async or in another thread? what is not working
Cuda
Cuda•2mo ago
to start when I try to update the listboox with a background worker that has a streamreader it doesn't update it. Inside the background worker I have a simple loop that is checking the file. Then I simply open notepad and update that file.txt (example) . This never updates the contents of the listbox.
ffmpeg -i me -f null -
there are a bunch of details you left out if you are not using await ReadAsync then you need to cope with updating the ui thread if you are not using try-catch in the background worker it may be crashing if this was linux this logic should work, but on windows im not sure a streamreader has the 'follow' ability to read appended data, i should try it