Merge pull request #6965 from Dhilan007/v3-wp8fix

Support Fast App Resume and fixed black screen may arise when using third sdk.
This commit is contained in:
minggo 2014-06-04 17:15:13 +08:00
commit 7a4d46dc1b
4 changed files with 29 additions and 5 deletions

View File

@ -140,13 +140,37 @@ namespace PhoneDirect3DXamlAppInterop
RootFrame.Navigated -= CompleteInitializePhoneApplication;
}
private bool _isResume = false;
private void CheckForResetNavigation(object sender, NavigationEventArgs e)
{
// If the app has received a 'reset' navigation, then we need to check
// on the next navigation to see if the page stack should be reset
if (e.NavigationMode == NavigationMode.Reset)
{
RootFrame.Navigating += HandlerFotResetNavigating;
_isResume = true;
}
else
{
if (_isResume && e.NavigationMode == NavigationMode.Refresh)
{
RootFrame.Navigating -= HandlerFotResetNavigating;
_isResume = false;
}
}
}
private void HandlerFotResetNavigating(object sender, NavigatingCancelEventArgs e)
{
RootFrame.Navigating -= HandlerFotResetNavigating;
if (e.Uri.OriginalString.Contains("MainPage.xaml"))
{
e.Cancel = true;
}
else
{
RootFrame.Navigated += ClearBackStackAfterReset;
}
_isResume = false;
}
private void ClearBackStackAfterReset(object sender, NavigationEventArgs e)
{

View File

@ -11,7 +11,7 @@
<Capability Name="ID_CAP_WEBBROWSERCOMPONENT"/>
</Capabilities>
<Tasks>
<DefaultTask Name="_default" NavigationPage="MainPage.xaml" />
<DefaultTask Name="_default" NavigationPage="MainPage.xaml" ActivationPolicy="Resume"/>
</Tasks>
<Tokens>
<PrimaryToken TokenID="PhoneDirect3DXamlAppInteropToken" TaskName="_default">

View File

@ -11,7 +11,7 @@
<Capability Name="ID_CAP_WEBBROWSERCOMPONENT"/>
</Capabilities>
<Tasks>
<DefaultTask Name="_default" NavigationPage="MainPage.xaml" />
<DefaultTask Name="_default" NavigationPage="MainPage.xaml" ActivationPolicy="Resume"/>
</Tasks>
<Tokens>
<PrimaryToken TokenID="PhoneDirect3DXamlAppInteropToken" TaskName="_default">

View File

@ -11,7 +11,7 @@
<Capability Name="ID_CAP_WEBBROWSERCOMPONENT" />
</Capabilities>
<Tasks>
<DefaultTask Name="_default" NavigationPage="MainPage.xaml" />
<DefaultTask Name="_default" NavigationPage="MainPage.xaml" ActivationPolicy="Resume"/>
</Tasks>
<Tokens>
<PrimaryToken TokenID="PhoneDirect3DXamlAppInteropToken" TaskName="_default">