2

I want to run wpf application with custom parameters in command prompt, basically this is achieve with no gui, if i don't run from command prompt, it should show gui!

1 Answer 1

3

Do this-

1) Add event -> Startup="App_Startup" to App.Xaml

2) Add Event handler for "App_Startup" to App.Xaml.cs

3) In "App_Startup" you can check command params this way-

     if (e.Args.Length == 0)
        {
            MainWindow m = new MainWindow();
            m.Show();
        }

4) Remove StartupUri from App.Xaml

This way WPF GUI will appear only if there is no command args.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.