Skip to content

Commit e0fabb8

Browse files
committed
Windows 10 RTM Release - March 2016 Update 2
1 parent 46269af commit e0fabb8

File tree

17 files changed

+1415
-5
lines changed

17 files changed

+1415
-5
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,9 @@ For additional Windows samples, see [Windows on GitHub](http://microsoft.github.
419419
<td><a href="Samples/BackgroundTask">Background task</a></td>
420420
<td><a href="Samples/ExtendedExecution">Extended execution</a></td>
421421
</tr>
422+
<tr>
423+
<td><a href="Samples/BasicSuspension">Suspend and resume</a></td>
424+
</tr>
422425
</table>
423426
<table>
424427
<tr>

Samples/AppServices/shared/KeepConnectionOpenScenario.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
<TextBox x:Name="MinValue" Text="0" VerticalAlignment="Center" Margin="5,0,0,0" />
5555
</StackPanel>
5656
<StackPanel Orientation="Horizontal" Margin="0,10,0,0">
57-
<TextBlock Text="Minimum Value:" VerticalAlignment="Center"/>
57+
<TextBlock Text="Maximum Value:" VerticalAlignment="Center"/>
5858
<TextBox x:Name="MaxValue" Text="10" VerticalAlignment="Center" Margin="5,0,0,0" />
5959
</StackPanel>
6060
<Button x:Name="GenerateRandomNumber" Content="Generate Random Number" Margin="0, 10, 0, 0" Click="GenerateRandomNumber_Click" />

Samples/BasicSuspension/README.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<!---
2+
category: LaunchingAndBackgroundTasks
3+
samplefwlink: http://go.microsoft.com/fwlink/?LinkID=761251
4+
--->
5+
6+
# Basic Suspension Sample
7+
8+
This sample demonstrates how to suspend, shut down and resume your application using the Suspension Manager.
9+
10+
Specifically, this sample covers:
11+
12+
- Saving state when the app is suspended or shut down.
13+
- Restoring state when the app is resumed from suspension or reactivated after being shut down.
14+
15+
From the Visual Studio debugging toolbar, use the Lifecycle Events menu to trigger suspend and resume events.
16+
17+
**Note** The Universal Windows app samples require Visual Studio 2015 to build and Windows 10 to execute.
18+
19+
To obtain an insider copy of Windows 10, go to [Windows 10](http://insider.windows.com).
20+
21+
**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).
22+
23+
## Related topics
24+
25+
[Guidelines for app suspend and resume](https://msdn.microsoft.com/library/windows/apps/hh465088.aspx)
26+
27+
[How to trigger suspend, resume, and background events for Windows Store apps in Visual Studio](https://msdn.microsoft.com/library/hh974425.aspx)
28+
29+
30+
## System requirements
31+
32+
**Client:** Windows 10
33+
34+
**Server:** Windows Server 2016 Technical Preview
35+
36+
**Phone:** Windows 10
37+
38+
## Build the sample
39+
40+
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.
41+
2. Start Microsoft Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
42+
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.
43+
4. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
44+
45+
## Run the sample
46+
47+
The next steps depend on whether you just want to deploy the sample or you want to both deploy and run it.
48+
49+
### Deploying the sample
50+
51+
- Select Build > Deploy Solution.
52+
53+
### Deploying and running the sample
54+
55+
- 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.
56+
- On the Debug Location toolbar, choose the event that you want to fire: Suspend, Resume, Suspend and Shutdown
57+
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<Application
2+
x:Class="SDKTemplate.App"
3+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
4+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5+
xmlns:local="using:SDKTemplate"
6+
RequestedTheme="Light">
7+
8+
</Application>
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
using SDKTemplate.Common;
2+
using System;
3+
using System.Collections.Generic;
4+
using Windows.ApplicationModel;
5+
using Windows.ApplicationModel.Activation;
6+
using Windows.Storage;
7+
using Windows.UI.Xaml;
8+
using Windows.UI.Xaml.Controls;
9+
using Windows.UI.Xaml.Navigation;
10+
11+
namespace SDKTemplate
12+
{
13+
/// <summary>
14+
/// Provides application-specific behavior to supplement the default Application class.
15+
/// </summary>
16+
sealed partial class App : Application
17+
{
18+
private const string sessionStateFilename = "_sessionState.xml";
19+
private RootFrameNavigationHelper rootFrameNavigationHelper;
20+
21+
/// <summary>
22+
/// Initializes the singleton application object. This is the first line of authored code
23+
/// executed, and as such is the logical equivalent of main() or WinMain().
24+
/// </summary>
25+
public App()
26+
{
27+
this.InitializeComponent();
28+
SuspensionManager.KnownTypes.AddRange(new[] { typeof(ItemList), typeof(Item) });
29+
this.Suspending += OnSuspending;
30+
}
31+
32+
/// <summary>
33+
/// Invoked when the application is launched normally by the end user. Other entry points
34+
/// will be used such as when the application is launched to open a specific file.
35+
/// </summary>
36+
/// <param name="e">Details about the launch request and process.</param>
37+
protected override async void OnLaunched(LaunchActivatedEventArgs e)
38+
{
39+
Frame rootFrame = Window.Current.Content as Frame;
40+
41+
// Do not repeat app initialization when the Window already has content,
42+
// just ensure that the window is active
43+
if (rootFrame == null)
44+
{
45+
// Create a Frame to act as the navigation context and navigate to the first page
46+
rootFrame = new Frame();
47+
SuspensionManager.RegisterFrame(rootFrame, "AppFrame");
48+
49+
// Use the RootFrameNavigationHelper to respond to keyboard and mouse shortcuts.
50+
this.rootFrameNavigationHelper = new RootFrameNavigationHelper(rootFrame);
51+
52+
rootFrame.NavigationFailed += OnNavigationFailed;
53+
54+
// If this is not the first time the app is run, then restore from the previous session.
55+
StorageFile file;
56+
try
57+
{
58+
file = await ApplicationData.Current.LocalFolder.GetFileAsync(sessionStateFilename);
59+
}
60+
catch (Exception)
61+
{
62+
file = null;
63+
}
64+
65+
if (file != null)
66+
{
67+
//Load state from previously suspended application
68+
await SuspensionManager.RestoreAsync();
69+
}
70+
71+
// Place the frame in the current Window
72+
Window.Current.Content = rootFrame;
73+
}
74+
75+
if (rootFrame.Content == null)
76+
{
77+
// When the navigation stack isn't restored navigate to the first page,
78+
// configuring the new page by passing required information as a navigation
79+
// parameter
80+
rootFrame.Navigate(typeof(MainPage), e.Arguments);
81+
}
82+
// Ensure the current window is active
83+
Window.Current.Activate();
84+
}
85+
86+
/// <summary>
87+
/// Invoked when Navigation to a certain page fails
88+
/// </summary>
89+
/// <param name="sender">The Frame which failed navigation</param>
90+
/// <param name="e">Details about the navigation failure</param>
91+
void OnNavigationFailed(object sender, NavigationFailedEventArgs e)
92+
{
93+
throw new Exception("Failed to load Page " + e.SourcePageType.FullName);
94+
}
95+
96+
/// <summary>
97+
/// Invoked when application execution is being suspended. Application state is saved
98+
/// without knowing whether the application will be terminated or resumed with the contents
99+
/// of memory still intact.
100+
/// </summary>
101+
/// <param name="sender">The source of the suspend request.</param>
102+
/// <param name="e">Details about the suspend request.</param>
103+
private async void OnSuspending(object sender, SuspendingEventArgs e)
104+
{
105+
var deferral = e.SuspendingOperation.GetDeferral();
106+
107+
// Save application state and stop any background activity.
108+
await SuspensionManager.SaveAsync();
109+
deferral.Complete();
110+
}
111+
}
112+
}
Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+
<PropertyGroup>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
7+
<ProjectGuid>{F187A516-647E-4597-AFEE-DCB4A9311B73}</ProjectGuid>
8+
<OutputType>AppContainerExe</OutputType>
9+
<AppDesignerFolder>Properties</AppDesignerFolder>
10+
<RootNamespace>SDKTemplate</RootNamespace>
11+
<AssemblyName>BasicSuspension</AssemblyName>
12+
<DefaultLanguage>en-US</DefaultLanguage>
13+
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
14+
<TargetPlatformVersion>10.0.10240.0</TargetPlatformVersion>
15+
<TargetPlatformMinVersion>10.0.10240.0</TargetPlatformMinVersion>
16+
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
17+
<EnableDotNetNativeCompatibleProfile>true</EnableDotNetNativeCompatibleProfile>
18+
<FileAlignment>512</FileAlignment>
19+
<ProjectTypeGuids>{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
20+
</PropertyGroup>
21+
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
22+
<DebugSymbols>true</DebugSymbols>
23+
<OutputPath>bin\x86\Debug\</OutputPath>
24+
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
25+
<NoWarn>;2008</NoWarn>
26+
<DebugType>full</DebugType>
27+
<PlatformTarget>x86</PlatformTarget>
28+
<UseVSHostingProcess>false</UseVSHostingProcess>
29+
<ErrorReport>prompt</ErrorReport>
30+
<Prefer32Bit>true</Prefer32Bit>
31+
</PropertyGroup>
32+
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
33+
<OutputPath>bin\x86\Release\</OutputPath>
34+
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
35+
<Optimize>true</Optimize>
36+
<NoWarn>;2008</NoWarn>
37+
<DebugType>pdbonly</DebugType>
38+
<PlatformTarget>x86</PlatformTarget>
39+
<UseVSHostingProcess>false</UseVSHostingProcess>
40+
<ErrorReport>prompt</ErrorReport>
41+
<Prefer32Bit>true</Prefer32Bit>
42+
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
43+
</PropertyGroup>
44+
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|ARM'">
45+
<DebugSymbols>true</DebugSymbols>
46+
<OutputPath>bin\ARM\Debug\</OutputPath>
47+
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
48+
<NoWarn>;2008</NoWarn>
49+
<DebugType>full</DebugType>
50+
<PlatformTarget>ARM</PlatformTarget>
51+
<UseVSHostingProcess>false</UseVSHostingProcess>
52+
<ErrorReport>prompt</ErrorReport>
53+
<Prefer32Bit>true</Prefer32Bit>
54+
</PropertyGroup>
55+
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|ARM'">
56+
<OutputPath>bin\ARM\Release\</OutputPath>
57+
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
58+
<Optimize>true</Optimize>
59+
<NoWarn>;2008</NoWarn>
60+
<DebugType>pdbonly</DebugType>
61+
<PlatformTarget>ARM</PlatformTarget>
62+
<UseVSHostingProcess>false</UseVSHostingProcess>
63+
<ErrorReport>prompt</ErrorReport>
64+
<Prefer32Bit>true</Prefer32Bit>
65+
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
66+
</PropertyGroup>
67+
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
68+
<DebugSymbols>true</DebugSymbols>
69+
<OutputPath>bin\x64\Debug\</OutputPath>
70+
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
71+
<NoWarn>;2008</NoWarn>
72+
<DebugType>full</DebugType>
73+
<PlatformTarget>x64</PlatformTarget>
74+
<UseVSHostingProcess>false</UseVSHostingProcess>
75+
<ErrorReport>prompt</ErrorReport>
76+
<Prefer32Bit>true</Prefer32Bit>
77+
</PropertyGroup>
78+
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
79+
<OutputPath>bin\x64\Release\</OutputPath>
80+
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
81+
<Optimize>true</Optimize>
82+
<NoWarn>;2008</NoWarn>
83+
<DebugType>pdbonly</DebugType>
84+
<PlatformTarget>x64</PlatformTarget>
85+
<UseVSHostingProcess>false</UseVSHostingProcess>
86+
<ErrorReport>prompt</ErrorReport>
87+
<Prefer32Bit>true</Prefer32Bit>
88+
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
89+
</PropertyGroup>
90+
<ItemGroup>
91+
<!-- A reference to the entire .Net Framework and Windows SDK are automatically included -->
92+
<None Include="project.json" />
93+
</ItemGroup>
94+
<ItemGroup>
95+
<Compile Include="App.xaml.cs">
96+
<DependentUpon>App.xaml</DependentUpon>
97+
</Compile>
98+
<Compile Include="Common\NavigationHelper.cs" />
99+
<Compile Include="Common\SuspensionManager.cs" />
100+
<Compile Include="MainPage.xaml.cs">
101+
<DependentUpon>MainPage.xaml</DependentUpon>
102+
</Compile>
103+
<Compile Include="..\..\..\SharedContent\cs\AssemblyInfo.cs">
104+
<Link>Properties\AssemblyInfo.cs</Link>
105+
</Compile>
106+
<Compile Include="SubPage.xaml.cs">
107+
<DependentUpon>SubPage.xaml</DependentUpon>
108+
</Compile>
109+
</ItemGroup>
110+
<ItemGroup>
111+
<AppxManifest Include="Package.appxmanifest">
112+
<SubType>Designer</SubType>
113+
</AppxManifest>
114+
</ItemGroup>
115+
<ItemGroup>
116+
<Content Include="..\..\..\SharedContent\cs\Default.rd.xml">
117+
<Link>Properties\Default.rd.xml</Link>
118+
</Content>
119+
<Content Include="..\..\..\SharedContent\media\splash-sdk.png">
120+
<Link>Assets\Splash-sdk.png</Link>
121+
</Content>
122+
<Content Include="..\..\..\SharedContent\media\squaretile-sdk.png">
123+
<Link>Assets\squareTile-sdk.png</Link>
124+
</Content>
125+
<Content Include="..\..\..\SharedContent\media\smalltile-sdk.png">
126+
<Link>Assets\smallTile-sdk.png</Link>
127+
</Content>
128+
<Content Include="..\..\..\SharedContent\media\storelogo-sdk.png">
129+
<Link>Assets\StoreLogo-sdk.png</Link>
130+
</Content>
131+
</ItemGroup>
132+
<ItemGroup>
133+
<ApplicationDefinition Include="App.xaml">
134+
<Generator>MSBuild:Compile</Generator>
135+
<SubType>Designer</SubType>
136+
</ApplicationDefinition>
137+
<Page Include="MainPage.xaml">
138+
<Generator>MSBuild:Compile</Generator>
139+
<SubType>Designer</SubType>
140+
</Page>
141+
<Page Include="SubPage.xaml">
142+
<SubType>Designer</SubType>
143+
<Generator>MSBuild:Compile</Generator>
144+
</Page>
145+
</ItemGroup>
146+
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '14.0' ">
147+
<VisualStudioVersion>14.0</VisualStudioVersion>
148+
</PropertyGroup>
149+
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
150+
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
151+
Other similar extension points exist, see Microsoft.Common.targets.
152+
<Target Name="BeforeBuild">
153+
</Target>
154+
<Target Name="AfterBuild">
155+
</Target>
156+
-->
157+
</Project>
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio 14
4+
VisualStudioVersion = 14.0.24720.0
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BasicSuspension", "BasicSuspension.csproj", "{F187A516-647E-4597-AFEE-DCB4A9311B73}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|ARM = Debug|ARM
11+
Debug|x64 = Debug|x64
12+
Debug|x86 = Debug|x86
13+
Release|ARM = Release|ARM
14+
Release|x64 = Release|x64
15+
Release|x86 = Release|x86
16+
EndGlobalSection
17+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
18+
{F187A516-647E-4597-AFEE-DCB4A9311B73}.Debug|ARM.ActiveCfg = Debug|ARM
19+
{F187A516-647E-4597-AFEE-DCB4A9311B73}.Debug|ARM.Build.0 = Debug|ARM
20+
{F187A516-647E-4597-AFEE-DCB4A9311B73}.Debug|ARM.Deploy.0 = Debug|ARM
21+
{F187A516-647E-4597-AFEE-DCB4A9311B73}.Debug|x64.ActiveCfg = Debug|x64
22+
{F187A516-647E-4597-AFEE-DCB4A9311B73}.Debug|x64.Build.0 = Debug|x64
23+
{F187A516-647E-4597-AFEE-DCB4A9311B73}.Debug|x64.Deploy.0 = Debug|x64
24+
{F187A516-647E-4597-AFEE-DCB4A9311B73}.Debug|x86.ActiveCfg = Debug|x86
25+
{F187A516-647E-4597-AFEE-DCB4A9311B73}.Debug|x86.Build.0 = Debug|x86
26+
{F187A516-647E-4597-AFEE-DCB4A9311B73}.Debug|x86.Deploy.0 = Debug|x86
27+
{F187A516-647E-4597-AFEE-DCB4A9311B73}.Release|ARM.ActiveCfg = Release|ARM
28+
{F187A516-647E-4597-AFEE-DCB4A9311B73}.Release|ARM.Build.0 = Release|ARM
29+
{F187A516-647E-4597-AFEE-DCB4A9311B73}.Release|ARM.Deploy.0 = Release|ARM
30+
{F187A516-647E-4597-AFEE-DCB4A9311B73}.Release|x64.ActiveCfg = Release|x64
31+
{F187A516-647E-4597-AFEE-DCB4A9311B73}.Release|x64.Build.0 = Release|x64
32+
{F187A516-647E-4597-AFEE-DCB4A9311B73}.Release|x64.Deploy.0 = Release|x64
33+
{F187A516-647E-4597-AFEE-DCB4A9311B73}.Release|x86.ActiveCfg = Release|x86
34+
{F187A516-647E-4597-AFEE-DCB4A9311B73}.Release|x86.Build.0 = Release|x86
35+
{F187A516-647E-4597-AFEE-DCB4A9311B73}.Release|x86.Deploy.0 = Release|x86
36+
EndGlobalSection
37+
GlobalSection(SolutionProperties) = preSolution
38+
HideSolutionNode = FALSE
39+
EndGlobalSection
40+
EndGlobal

0 commit comments

Comments
 (0)