, , tomstoning. , . - SplashPage.xaml. UriMapper :
private void Application_Activated(object sender, ActivatedEventArgs e) {
IsTombstoned = ! e.IsApplicationInstancePreserved;
if (IsTombstoned) {
RootFrame.UriMapper = new RestartUriMapper();
}
}
SplashPage.xaml, , , ( ).
protected override void OnNavigatedTo(NavigationEventArgs e) {
base.OnNavigatedTo(e);
if (NavigationContext.QueryString.ContainsKey("restart")) {
var app = Application.Current as App;
app.RootFrame.UriMapper = App.Root.AssociationUriMapper;
App.PageNavigation.Navigate(@"/Pages/SplashPage.xaml?fromtomb=true");
}
}
class RestartUriMapper : UriMapperBase {
Uri restartUri;
public RestartUriMapper() {
restartUri = new Uri(string.Format("/Pages/SplashPage.xaml?restart={0}", true.ToString()), UriKind.Relative);
}
public override Uri MapUri(Uri uri) {
if (restartUri != null) {
Uri nextPageUri = restartUri;
restartUri = null;
return nextPageUri;
}
return uri;
}
}