Wednesday, 15 February 2012

.net - How to Navigate to running screen if app is accessed in windows phone? -


I am trying to develop location tracking. In this app, the first user opens the main screen. Then she chooses to run the application that goes to the second screen. So it works in the background too. Now, if the user opens the app then it should not be sent directly to the first screen directly on the second screen. how? Any suggestions, pls post them.
// code

  Private Zero TimesTit (Object Sender, EventAGRS E) {TimeSpain Runtime = Timespan From Milliseconds (Systems Environmental Tickcant - _starttime); TimeLabel.Text = runTime.ToString (@ "hh \: mm \: ss"); } The easiest way (I think), while loading the first screen,    Redirect to the second screen to remove the page from the backstack.  

In the first screen:

  to protect override zero-on navigation (Navigation Event E.) {Navigation service. Navigate (new uri ("/ secondscreex.mml", uricind.relative)); }   

In the second screen:

  Protected override was navigated on zero (navigation avent erg e) {Navigation service. Rewblack Entry (); }   

Another way is to use custom URI Mapper to display the second screen when the first screen is called. It's a bit more complex but you avoid the now-useless navigation on the first screen. This code should be called in App.xaml.cs in the initial form of the application, only once before and before navigation:

  var mapper = new UriMapper (); Int random = new random (). Next (0, 3); Mapper Erymapings Add (new Uremapping {Uri = New Uri ("/ FirstScreen.xml", UricKind.Relative), MapUri = New Uri ("/ Secondscreen.xml", Urikhind.Relative)}); Application Present. Rootframe URImapper = Mapper;    

No comments:

Post a Comment