update background events
This commit is contained in:
Родитель
d3f13f5c53
Коммит
632c0c70da
|
@ -90,24 +90,38 @@ namespace Music
|
|||
{
|
||||
_isInBackgroundMode = false;
|
||||
|
||||
// Reastore view content if it was previously unloaded.
|
||||
if (Window.Current.Content == null)
|
||||
// Restore view content if it was previously unloaded.
|
||||
if (Window.Current != null && Window.Current.Content == null)
|
||||
{
|
||||
CreateRootFrame(ApplicationExecutionState.Running, string.Empty);
|
||||
}
|
||||
|
||||
Debug.WriteLine("Leaving Background");
|
||||
}
|
||||
|
||||
private void App_EnteredBackground(object sender, EnteredBackgroundEventArgs e)
|
||||
{
|
||||
_isInBackgroundMode = true;
|
||||
Debug.WriteLine("Entered Background");
|
||||
ReduceMemoryUsage(0);
|
||||
var deferral = e.GetDeferral();
|
||||
try
|
||||
{
|
||||
_isInBackgroundMode = true;
|
||||
#if DEBUG
|
||||
//If we are in debug mode free memory here because the memory limits are turned off
|
||||
//In release builds defer the actual reduction of memory to the limit changing event so we don't
|
||||
//unnecessarily throw away the UI
|
||||
ReduceMemoryUsage(0);
|
||||
#endif
|
||||
}
|
||||
finally
|
||||
{
|
||||
deferral.Complete();
|
||||
}
|
||||
}
|
||||
|
||||
public void ReduceMemoryUsage(ulong limit)
|
||||
{
|
||||
if (_isInBackgroundMode && Window.Current.Content != null)
|
||||
if (_isInBackgroundMode && Window.Current != null && Window.Current.Content != null)
|
||||
{
|
||||
ApplicationData.Current.LocalSettings.Values["navState"] = (Window.Current.Content as Frame).GetNavigationState();
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
<PackageCertificateKeyFile>Music_TemporaryKey.pfx</PackageCertificateKeyFile>
|
||||
<AppxAutoIncrementPackageRevision>True</AppxAutoIncrementPackageRevision>
|
||||
<AppxBundle>Always</AppxBundle>
|
||||
<AppxBundlePlatforms>x86</AppxBundlePlatforms>
|
||||
<AppxBundlePlatforms>x86|x64|arm</AppxBundlePlatforms>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest" xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" xmlns:uap3="http://schemas.microsoft.com/appx/manifest/uap/windows10/3" IgnorableNamespaces="uap mp uap3">
|
||||
<Identity Name="835bc6b5-3b58-4669-9d8a-15cb9b49fa94" Publisher="CN=nikola" Version="1.0.3.0" />
|
||||
<Identity Name="835bc6b5-3b58-4669-9d8a-15cb9b49fa94" Publisher="CN=nikola" Version="1.0.5.0" />
|
||||
<mp:PhoneIdentity PhoneProductId="835bc6b5-3b58-4669-9d8a-15cb9b49fa94" PhonePublisherId="00000000-0000-0000-0000-000000000000" />
|
||||
<Properties>
|
||||
<DisplayName>Music</DisplayName>
|
||||
|
|
Загрузка…
Ссылка в новой задаче