M. Schevers
M. Schevers

Reputation: 129

How to make a setup that has input in the program it installs?

I'm making a program that gets information from a database and puts in a grid in an agenda-like way. What I want my user to do during the installation of that program, is logging in (which is checked through a database) and that the program remembers who installed the program so that the program only gets the information relevant to that user.

The user logs in with an 9-digit number and a text+number password.

Any one who has an idea if it is even possible to do such a thing?

If not, suggestions of alternatives are welcome.

Upvotes: 1

Views: 105

Answers (1)

Neville Kuyt
Neville Kuyt

Reputation: 29639

You could probably do this using a custom installer - but I've found that building installers for .Net is a bit of an obscure process. Microsoft's guidance is here. I'd have the installer be as dumb as possible - just install the app, basically. The installer should be able to deploy your local database - depending on which engine you're using - and set up an app.config file to allow you to connect. I'd have all the smart stuff happen in the app itself.

I'd recommend writing this logic as an "initialize" step in your application - that way, you can offer it as an option for multiple users on the same machine, or in the case of catastrophic failure.

At startup of your app, you need to check for the presence of a database connection; if that's not there, offer the user the "setup database" screen. If you can connect, but the database hasn't yet been initialized - e.g. the dates in the agenda aren't there yet - have a separate initialisation step.

I'd use one of the "wizard" frameworks to make the process as easy as it can possibly be.

The benefit of doing this within the main app, rather than the installer, is that you have the full power of C# at your disposal, and you can test it in the context of your app, rather than within the installer script.

Upvotes: 3

Related Questions