Address: http://www.cnblogs.com/jpwang/archive/2012/04/01/2429027.html
In the blog Park, I saw how many people wrote about how to exit the Windows Phone application. In fact, Windows Phone'sProgramYou do not need to exit.
However, some children's shoes need to be studied. Some methods have been used to summarize all of them!
The following method is correct
Public static void gomainpagewithback (navigationservice, string mainpageurl)
{
While (navigationservice. cangoback)
{
Ienumerator <journalentry> List = navigationservice. backstack. getenumerator ();
List. movenext ();
Journalentry current = List. Current;
String uri = current. Source. tostring ();
If (uri = mainpageurl)
{
Navigationservice. Goback ();
}
Else
{
Navigationservice. removebackentry ();
}
}
}
The general meaning is to remove the page in your navigation stack. If it is the homepage, Goback () and then you will go out!