Search code examples
wpfxmlapp.xaml

Does anyone know how to change the Properties.Settings.Default.{} form App.xaml.cs?


Can anyone point me in the right direction? I need some way to change Properties.Settings.Default when my application starts by adding values from am xml if it exists and bypass the StartupUri from App.xaml, actually creating a different window. If that xml file doesn't exist Run the StartupUri from the App.xaml (which will be a login Window).

Any ideas?

Thanks before hand.


Solution

  • remove the startupuri from your app.xaml an override OnStartup() in your app.xaml.cs

    protected override void OnStartup(StartupEventArgs e)
    {
        //todo settings
        var login = new LoginWindow();
        var result = login.ShowDialog()
    
        //do something with result
    
        this.MainWindow = new MyMainWindow();
        this.MainWindow.Show();
    }
    

    i dont know what you really want with your Properties.Settings...