-
Notifications
You must be signed in to change notification settings - Fork 8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Windows 10 RTM Release - March 2016 Update 2
- Loading branch information
1 parent
46269af
commit e0fabb8
Showing
17 changed files
with
1,415 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<!--- | ||
category: LaunchingAndBackgroundTasks | ||
samplefwlink: http://go.microsoft.com/fwlink/?LinkID=761251 | ||
---> | ||
|
||
# Basic Suspension Sample | ||
|
||
This sample demonstrates how to suspend, shut down and resume your application using the Suspension Manager. | ||
|
||
Specifically, this sample covers: | ||
|
||
- Saving state when the app is suspended or shut down. | ||
- Restoring state when the app is resumed from suspension or reactivated after being shut down. | ||
|
||
From the Visual Studio debugging toolbar, use the Lifecycle Events menu to trigger suspend and resume events. | ||
|
||
**Note** The Universal Windows app samples require Visual Studio 2015 to build and Windows 10 to execute. | ||
|
||
To obtain an insider copy of Windows 10, go to [Windows 10](http://insider.windows.com). | ||
|
||
**Note** For Windows 10 app samples, go to [Windows 10 Samples](https://github.com/Microsoft/Windows-universal-samples). The samples for Windows 10 can be built and run using Windows developer [tools](https://developer.windows.com). | ||
|
||
## Related topics | ||
|
||
[Guidelines for app suspend and resume](https://msdn.microsoft.com/library/windows/apps/hh465088.aspx) | ||
|
||
[How to trigger suspend, resume, and background events for Windows Store apps in Visual Studio](https://msdn.microsoft.com/library/hh974425.aspx) | ||
|
||
|
||
## System requirements | ||
|
||
**Client:** Windows 10 | ||
|
||
**Server:** Windows Server 2016 Technical Preview | ||
|
||
**Phone:** Windows 10 | ||
|
||
## Build the sample | ||
|
||
1. If you download the samples ZIP, be sure to unzip the entire archive, not just the folder with the sample you want to build. | ||
2. Start Microsoft Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**. | ||
3. Starting in the folder where you unzipped the samples, go to the Samples subfolder, then the subfolder for this specific sample, then the subfolder for your preferred language (C++, C#, or JavaScript). Double-click the Visual Studio 2015 Solution (.sln) file. | ||
4. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**. | ||
|
||
## Run the sample | ||
|
||
The next steps depend on whether you just want to deploy the sample or you want to both deploy and run it. | ||
|
||
### Deploying the sample | ||
|
||
- Select Build > Deploy Solution. | ||
|
||
### Deploying and running the sample | ||
|
||
- To debug the sample and then run it, press F5 or select Debug > Start Debugging. To run the sample without debugging, press Ctrl+F5 or select Debug > Start Without Debugging. | ||
- On the Debug Location toolbar, choose the event that you want to fire: Suspend, Resume, Suspend and Shutdown | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<Application | ||
x:Class="SDKTemplate.App" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:local="using:SDKTemplate" | ||
RequestedTheme="Light"> | ||
|
||
</Application> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
using SDKTemplate.Common; | ||
using System; | ||
using System.Collections.Generic; | ||
using Windows.ApplicationModel; | ||
using Windows.ApplicationModel.Activation; | ||
using Windows.Storage; | ||
using Windows.UI.Xaml; | ||
using Windows.UI.Xaml.Controls; | ||
using Windows.UI.Xaml.Navigation; | ||
|
||
namespace SDKTemplate | ||
{ | ||
/// <summary> | ||
/// Provides application-specific behavior to supplement the default Application class. | ||
/// </summary> | ||
sealed partial class App : Application | ||
{ | ||
private const string sessionStateFilename = "_sessionState.xml"; | ||
private RootFrameNavigationHelper rootFrameNavigationHelper; | ||
|
||
/// <summary> | ||
/// Initializes the singleton application object. This is the first line of authored code | ||
/// executed, and as such is the logical equivalent of main() or WinMain(). | ||
/// </summary> | ||
public App() | ||
{ | ||
this.InitializeComponent(); | ||
SuspensionManager.KnownTypes.AddRange(new[] { typeof(ItemList), typeof(Item) }); | ||
this.Suspending += OnSuspending; | ||
} | ||
|
||
/// <summary> | ||
/// Invoked when the application is launched normally by the end user. Other entry points | ||
/// will be used such as when the application is launched to open a specific file. | ||
/// </summary> | ||
/// <param name="e">Details about the launch request and process.</param> | ||
protected override async void OnLaunched(LaunchActivatedEventArgs e) | ||
{ | ||
Frame rootFrame = Window.Current.Content as Frame; | ||
|
||
// Do not repeat app initialization when the Window already has content, | ||
// just ensure that the window is active | ||
if (rootFrame == null) | ||
{ | ||
// Create a Frame to act as the navigation context and navigate to the first page | ||
rootFrame = new Frame(); | ||
SuspensionManager.RegisterFrame(rootFrame, "AppFrame"); | ||
|
||
// Use the RootFrameNavigationHelper to respond to keyboard and mouse shortcuts. | ||
this.rootFrameNavigationHelper = new RootFrameNavigationHelper(rootFrame); | ||
|
||
rootFrame.NavigationFailed += OnNavigationFailed; | ||
|
||
// If this is not the first time the app is run, then restore from the previous session. | ||
StorageFile file; | ||
try | ||
{ | ||
file = await ApplicationData.Current.LocalFolder.GetFileAsync(sessionStateFilename); | ||
} | ||
catch (Exception) | ||
{ | ||
file = null; | ||
} | ||
|
||
if (file != null) | ||
{ | ||
//Load state from previously suspended application | ||
await SuspensionManager.RestoreAsync(); | ||
} | ||
|
||
// Place the frame in the current Window | ||
Window.Current.Content = rootFrame; | ||
} | ||
|
||
if (rootFrame.Content == null) | ||
{ | ||
// When the navigation stack isn't restored navigate to the first page, | ||
// configuring the new page by passing required information as a navigation | ||
// parameter | ||
rootFrame.Navigate(typeof(MainPage), e.Arguments); | ||
} | ||
// Ensure the current window is active | ||
Window.Current.Activate(); | ||
} | ||
|
||
/// <summary> | ||
/// Invoked when Navigation to a certain page fails | ||
/// </summary> | ||
/// <param name="sender">The Frame which failed navigation</param> | ||
/// <param name="e">Details about the navigation failure</param> | ||
void OnNavigationFailed(object sender, NavigationFailedEventArgs e) | ||
{ | ||
throw new Exception("Failed to load Page " + e.SourcePageType.FullName); | ||
} | ||
|
||
/// <summary> | ||
/// Invoked when application execution is being suspended. Application state is saved | ||
/// without knowing whether the application will be terminated or resumed with the contents | ||
/// of memory still intact. | ||
/// </summary> | ||
/// <param name="sender">The source of the suspend request.</param> | ||
/// <param name="e">Details about the suspend request.</param> | ||
private async void OnSuspending(object sender, SuspendingEventArgs e) | ||
{ | ||
var deferral = e.SuspendingOperation.GetDeferral(); | ||
|
||
// Save application state and stop any background activity. | ||
await SuspensionManager.SaveAsync(); | ||
deferral.Complete(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,157 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">x86</Platform> | ||
<ProjectGuid>{F187A516-647E-4597-AFEE-DCB4A9311B73}</ProjectGuid> | ||
<OutputType>AppContainerExe</OutputType> | ||
<AppDesignerFolder>Properties</AppDesignerFolder> | ||
<RootNamespace>SDKTemplate</RootNamespace> | ||
<AssemblyName>BasicSuspension</AssemblyName> | ||
<DefaultLanguage>en-US</DefaultLanguage> | ||
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier> | ||
<TargetPlatformVersion>10.0.10240.0</TargetPlatformVersion> | ||
<TargetPlatformMinVersion>10.0.10240.0</TargetPlatformMinVersion> | ||
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion> | ||
<EnableDotNetNativeCompatibleProfile>true</EnableDotNetNativeCompatibleProfile> | ||
<FileAlignment>512</FileAlignment> | ||
<ProjectTypeGuids>{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'"> | ||
<DebugSymbols>true</DebugSymbols> | ||
<OutputPath>bin\x86\Debug\</OutputPath> | ||
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants> | ||
<NoWarn>;2008</NoWarn> | ||
<DebugType>full</DebugType> | ||
<PlatformTarget>x86</PlatformTarget> | ||
<UseVSHostingProcess>false</UseVSHostingProcess> | ||
<ErrorReport>prompt</ErrorReport> | ||
<Prefer32Bit>true</Prefer32Bit> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'"> | ||
<OutputPath>bin\x86\Release\</OutputPath> | ||
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants> | ||
<Optimize>true</Optimize> | ||
<NoWarn>;2008</NoWarn> | ||
<DebugType>pdbonly</DebugType> | ||
<PlatformTarget>x86</PlatformTarget> | ||
<UseVSHostingProcess>false</UseVSHostingProcess> | ||
<ErrorReport>prompt</ErrorReport> | ||
<Prefer32Bit>true</Prefer32Bit> | ||
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|ARM'"> | ||
<DebugSymbols>true</DebugSymbols> | ||
<OutputPath>bin\ARM\Debug\</OutputPath> | ||
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants> | ||
<NoWarn>;2008</NoWarn> | ||
<DebugType>full</DebugType> | ||
<PlatformTarget>ARM</PlatformTarget> | ||
<UseVSHostingProcess>false</UseVSHostingProcess> | ||
<ErrorReport>prompt</ErrorReport> | ||
<Prefer32Bit>true</Prefer32Bit> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|ARM'"> | ||
<OutputPath>bin\ARM\Release\</OutputPath> | ||
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants> | ||
<Optimize>true</Optimize> | ||
<NoWarn>;2008</NoWarn> | ||
<DebugType>pdbonly</DebugType> | ||
<PlatformTarget>ARM</PlatformTarget> | ||
<UseVSHostingProcess>false</UseVSHostingProcess> | ||
<ErrorReport>prompt</ErrorReport> | ||
<Prefer32Bit>true</Prefer32Bit> | ||
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'"> | ||
<DebugSymbols>true</DebugSymbols> | ||
<OutputPath>bin\x64\Debug\</OutputPath> | ||
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants> | ||
<NoWarn>;2008</NoWarn> | ||
<DebugType>full</DebugType> | ||
<PlatformTarget>x64</PlatformTarget> | ||
<UseVSHostingProcess>false</UseVSHostingProcess> | ||
<ErrorReport>prompt</ErrorReport> | ||
<Prefer32Bit>true</Prefer32Bit> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'"> | ||
<OutputPath>bin\x64\Release\</OutputPath> | ||
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants> | ||
<Optimize>true</Optimize> | ||
<NoWarn>;2008</NoWarn> | ||
<DebugType>pdbonly</DebugType> | ||
<PlatformTarget>x64</PlatformTarget> | ||
<UseVSHostingProcess>false</UseVSHostingProcess> | ||
<ErrorReport>prompt</ErrorReport> | ||
<Prefer32Bit>true</Prefer32Bit> | ||
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<!-- A reference to the entire .Net Framework and Windows SDK are automatically included --> | ||
<None Include="project.json" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="App.xaml.cs"> | ||
<DependentUpon>App.xaml</DependentUpon> | ||
</Compile> | ||
<Compile Include="Common\NavigationHelper.cs" /> | ||
<Compile Include="Common\SuspensionManager.cs" /> | ||
<Compile Include="MainPage.xaml.cs"> | ||
<DependentUpon>MainPage.xaml</DependentUpon> | ||
</Compile> | ||
<Compile Include="..\..\..\SharedContent\cs\AssemblyInfo.cs"> | ||
<Link>Properties\AssemblyInfo.cs</Link> | ||
</Compile> | ||
<Compile Include="SubPage.xaml.cs"> | ||
<DependentUpon>SubPage.xaml</DependentUpon> | ||
</Compile> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<AppxManifest Include="Package.appxmanifest"> | ||
<SubType>Designer</SubType> | ||
</AppxManifest> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Content Include="..\..\..\SharedContent\cs\Default.rd.xml"> | ||
<Link>Properties\Default.rd.xml</Link> | ||
</Content> | ||
<Content Include="..\..\..\SharedContent\media\splash-sdk.png"> | ||
<Link>Assets\Splash-sdk.png</Link> | ||
</Content> | ||
<Content Include="..\..\..\SharedContent\media\squaretile-sdk.png"> | ||
<Link>Assets\squareTile-sdk.png</Link> | ||
</Content> | ||
<Content Include="..\..\..\SharedContent\media\smalltile-sdk.png"> | ||
<Link>Assets\smallTile-sdk.png</Link> | ||
</Content> | ||
<Content Include="..\..\..\SharedContent\media\storelogo-sdk.png"> | ||
<Link>Assets\StoreLogo-sdk.png</Link> | ||
</Content> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ApplicationDefinition Include="App.xaml"> | ||
<Generator>MSBuild:Compile</Generator> | ||
<SubType>Designer</SubType> | ||
</ApplicationDefinition> | ||
<Page Include="MainPage.xaml"> | ||
<Generator>MSBuild:Compile</Generator> | ||
<SubType>Designer</SubType> | ||
</Page> | ||
<Page Include="SubPage.xaml"> | ||
<SubType>Designer</SubType> | ||
<Generator>MSBuild:Compile</Generator> | ||
</Page> | ||
</ItemGroup> | ||
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' < '14.0' "> | ||
<VisualStudioVersion>14.0</VisualStudioVersion> | ||
</PropertyGroup> | ||
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" /> | ||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. | ||
Other similar extension points exist, see Microsoft.Common.targets. | ||
<Target Name="BeforeBuild"> | ||
</Target> | ||
<Target Name="AfterBuild"> | ||
</Target> | ||
--> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio 14 | ||
VisualStudioVersion = 14.0.24720.0 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BasicSuspension", "BasicSuspension.csproj", "{F187A516-647E-4597-AFEE-DCB4A9311B73}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|ARM = Debug|ARM | ||
Debug|x64 = Debug|x64 | ||
Debug|x86 = Debug|x86 | ||
Release|ARM = Release|ARM | ||
Release|x64 = Release|x64 | ||
Release|x86 = Release|x86 | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{F187A516-647E-4597-AFEE-DCB4A9311B73}.Debug|ARM.ActiveCfg = Debug|ARM | ||
{F187A516-647E-4597-AFEE-DCB4A9311B73}.Debug|ARM.Build.0 = Debug|ARM | ||
{F187A516-647E-4597-AFEE-DCB4A9311B73}.Debug|ARM.Deploy.0 = Debug|ARM | ||
{F187A516-647E-4597-AFEE-DCB4A9311B73}.Debug|x64.ActiveCfg = Debug|x64 | ||
{F187A516-647E-4597-AFEE-DCB4A9311B73}.Debug|x64.Build.0 = Debug|x64 | ||
{F187A516-647E-4597-AFEE-DCB4A9311B73}.Debug|x64.Deploy.0 = Debug|x64 | ||
{F187A516-647E-4597-AFEE-DCB4A9311B73}.Debug|x86.ActiveCfg = Debug|x86 | ||
{F187A516-647E-4597-AFEE-DCB4A9311B73}.Debug|x86.Build.0 = Debug|x86 | ||
{F187A516-647E-4597-AFEE-DCB4A9311B73}.Debug|x86.Deploy.0 = Debug|x86 | ||
{F187A516-647E-4597-AFEE-DCB4A9311B73}.Release|ARM.ActiveCfg = Release|ARM | ||
{F187A516-647E-4597-AFEE-DCB4A9311B73}.Release|ARM.Build.0 = Release|ARM | ||
{F187A516-647E-4597-AFEE-DCB4A9311B73}.Release|ARM.Deploy.0 = Release|ARM | ||
{F187A516-647E-4597-AFEE-DCB4A9311B73}.Release|x64.ActiveCfg = Release|x64 | ||
{F187A516-647E-4597-AFEE-DCB4A9311B73}.Release|x64.Build.0 = Release|x64 | ||
{F187A516-647E-4597-AFEE-DCB4A9311B73}.Release|x64.Deploy.0 = Release|x64 | ||
{F187A516-647E-4597-AFEE-DCB4A9311B73}.Release|x86.ActiveCfg = Release|x86 | ||
{F187A516-647E-4597-AFEE-DCB4A9311B73}.Release|x86.Build.0 = Release|x86 | ||
{F187A516-647E-4597-AFEE-DCB4A9311B73}.Release|x86.Deploy.0 = Release|x86 | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
EndGlobal |
Oops, something went wrong.