1

I have a WPF Application. It´s for testing a process. I start this over a console. When the process ends, the MainWindow will be closed with Window.Close(). Now I try to return a integer value when my program closes. It is possible to see this value in my console?

For example in Java has the method System.Exit(1). Then I can see the return value on my console. But is it possible in WPF Applications?

Maybe this is also the solution bottle and somebody has a better idea.

A.R.
  • 15,405
  • 19
  • 77
  • 123
Matapolo
  • 163
  • 2
  • 2
  • 10

2 Answers2

1

You call:

Application.Current.Shutdown(1);

See this question for more info: How to exit a WPF app programmatically?

Community
  • 1
  • 1
Oskar Kjellin
  • 21,280
  • 10
  • 54
  • 93
0

I believe you can call Environment.Exit(code)

msdn Environment.Exit

Joe
  • 80,724
  • 18
  • 127
  • 145