I am new to the thread model in .net. What would you use to:
- start a process that handles a file (process.StartInfo.FileName = fileName;)
- wait for the user to close the process OR abandon the thread after some time
- if the user closed the process, delete the file
Starting the process and waiting should be done on a different thread than the main thread, because this operation should not affect the application.
Example:
My application produces an html report. The user can right click somewhere and say "View Report" - now I retrieve the report contents in a temporary file and launch the process that handles html files i.e. the default browser. The problem is that I cannot cleanup, i.e. delete the temp file.