Donnerstag, 28. Oktober 2010

WindowsPhone 7: NavigationService.Back raises Exception

Sometime a NavigationService.Back call could raise an exception, if the user tombstoned your Windows phone 7 app and you try to call a Navigations.Back after this.

Possible szenario: You ask the user “Do you really want to delete this item?”. After returning a OK from your MessageBox you delete the item and in all cases you want to return from your detail page to your list page with NavigationService.Back.  To avoid a exception you have to put your NavigationService.Back call in a try..catch statement, because the user could press the windows button at your Messagebox and after this the CLR will raises a Cancel for your messagebox and executes the rest of your code with the NavigationService.Back call. Guess from me: Because this situation is not handled by the Silverlight for Windows Phone framework a exception will occur.

Trauriges SmileyTrauriges SmileyTrauriges Smiley

Keine Kommentare:

Kommentar veröffentlichen