c# - WPF Application exit code -


i trying set , application exit code .

i trying following :

protected override void onstartup(startupeventargs e) {     base.onstartup(e);      if ( e.args.length != 0)     {       }     else     {         new mainwindow().showdialog();     }     environment.exitcode = 110;     this.shutdown(); } 

and trying in cmd echo %errorlevel%

but result 0 , idea issue ?

for wpf, try

application.current.shutdown(110); 

note application needs running console app. this answer easiest way know of; accepted answer looks more difficult.

an easy test tell if you're running in console mode: call app command line (make sure code doesn't shut down right away). main window should showing. if can type command in console, app not running in context. command prompt should locked, waiting close window.


Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -