开发者

Return Value by closing MainWindow

开发者 https://www.devze.com 2023-04-11 19:15 出处:网络
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 m

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?

Mayb开发者_如何学Pythone this is also the solution bottle and somebody has a better idea.


You call:

Application.Current.Shutdown(1);

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


I believe you can call Environment.Exit(code)

msdn Environment.Exit

0

精彩评论

暂无评论...
验证码 换一张
取 消