ns12345
ns12345

Reputation: 3105

Ask for app option at startup?

I've a WPF app, the first thing I need to do is to ask user to select between 2 options, everything else follows after user selects an option of those 2. I want that dialog box to be shown even before the splash screen image.

What's the best place to write this code and what kind of control (messagebox or what?)

Upvotes: 0

Views: 60

Answers (1)

Davide Piras
Davide Piras

Reputation: 44605

you should show a form modally at startup, I am afraid MessageBox does not help because you can only show a text label and have default OK, Cancel or Yes, No, Cancel buttons in it.

(there are ways to create or overload message boxes but that's another chapter).

Not sure you want to really show that before the Splash Screen, depends on what you are doing, surely if you want to start different products depending on the selected options then it does make sense.

in fact all you need to do is show a dialog modally in the startup event, for example:

private void Application_Startup(object sender, StartupEventArgs e) 
{ 
  var options = new OptionDialog();

  options.ShowDialog();

  // here depending on something like options.SelectedOption you do what you need to do...

}

Upvotes: 2

Related Questions