Where to prompt for required file location at start of Win Forms application
Posted
by Murph
on Stack Overflow
See other posts from Stack Overflow
or by Murph
Published on 2010-03-18T10:51:09Z
Indexed on
2010/03/18
11:11 UTC
Read the original article
Hit count: 247
I have an application that uses a file to store its data.
I store the location of the file in the app settings so have two tests at startup:
- Do I have a setting for the file and
- Does the file (if I have a setting) exist
If I fail either test I want to prompt the user for the file location - the mechanics of the are not the problem, I can read and write the app settings, fire off dialogs and otherwise request the data. If the user refuses to choose a file (or at least a file location) I want to exit the app.
My problem is where to do this i.e. at what point in the flow of code. In an ideal world you start the app, show a splash screen, load the main form and run from there... I'm looking for a general pattern that allows me to slot the test for parameters into the right place so that I can prompt the user for whatever (and allowing that I have to worry about the fact that my splash screen is currently topmost for my app).
I appreciate that this is a bit vague so will update this with code as we go along.
© Stack Overflow or respective owner