Skip to content

Commit

Permalink
Windows 10 RTM Release - February 2016 Update
Browse files Browse the repository at this point in the history
  • Loading branch information
oldnewthing committed Feb 4, 2016
1 parent 1709b21 commit 94d11a6
Show file tree
Hide file tree
Showing 18 changed files with 1,037 additions and 8 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,7 @@ For additional Windows samples, see [Windows on GitHub](http://microsoft.github.
<tr>
<td><a href="Samples/AssociationLaunching">Association launching</a></td>
<td><a href="Samples/BackgroundTask">Background task</a></td>
<td><a href="Samples/ExtendedExecution">Extended execution</a></td>
</tr>
</table>
<table>
Expand Down
2 changes: 1 addition & 1 deletion Samples/BasicInput/cs/3-DeviceCapabilities.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public Scenario3()
System.Text.StringBuilder sb = new System.Text.StringBuilder();
sb.Append("Mouse present = " + mouseCapabilities.MousePresent.ToString() + "\n");
sb.Append("Number of buttons = " + mouseCapabilities.NumberOfButtons.ToString() + "\n");
sb.Append("Vertical wheel present present = " + mouseCapabilities.VerticalWheelPresent.ToString() + "\n");
sb.Append("Vertical wheel present = " + mouseCapabilities.VerticalWheelPresent.ToString() + "\n");
sb.Append("Horizontal wheel present = " + mouseCapabilities.HorizontalWheelPresent.ToString() + "\n");
sb.Append("Buttons swapped = " + mouseCapabilities.SwapButtons.ToString());
mouseText.Text = sb.ToString();
Expand Down
117 changes: 117 additions & 0 deletions Samples/ExtendedExecution/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
<!---
category: LaunchingAndBackgroundTasks
samplefwlink: http://go.microsoft.com/fwlink/?LinkId=723509
--->

# Extended execution sample

This sample shows you how to create extended execution sessions using the Windows Runtime extended execution API.

**Note** The Universal Windows app samples require Visual Studio 2015 to build and Windows 10 to execute.

An app requests an extended execution session when a task requires time to complete before the application is suspended or terminated.
Different types of extended execution can be requested during the Suspending state or the Resumed state of the application.

This sample demonstrates the following:

- Creating an extended execution session to extend suspending time and complete saving data.
- Creating an extended execution session to extend foreground time and continue location tracking.
- Creating an extended execution session to extend foreground time and continue an unspecified task.
- Handling a denied request for extended execution.
- Handling the revocation of an extended execution session.

See **Deploying and running the sample** below for instructions on using the sample.

## Related topics

### Samples

* [Background audio](/Samples/BackgroundAudio)
* [Geolocation](/Samples/Geolocation)

### Other resources

[Background Tasks and Extended Execution](https://msdn.microsoft.com/en-us/magazine/mt590969)

[Launching, resuming, and background tasks](https://msdn.microsoft.com/en-us/library/windows/apps/xaml/mt227652.aspx)

[Support your app with background tasks](https://msdn.microsoft.com/library/windows/apps/mt299103)

### Reference

[**Windows.ApplicationModel.ExtendedExecution**](https://msdn.microsoft.com/en-us/library/windows/apps/windows.applicationmodel.extendedexecution.aspx)

### Related technologies

[**Windows.ApplicationModel.Background**](http://msdn.microsoft.com/library/windows/apps/br224847)

## Operating 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

**Deploying the sample**

1. Select **Build** \> **Deploy Solution**.

**Deploying and running the sample**

1. 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**.
Since the system will not suspend an app that is being debugged,
some scenarios require you to run the sample without debugging.

**Unspecified Extended Execution**:

1. Run the sample without debugging and go to the **Unspecified Reason** scenario.
2. Click **Begin Extended Execution**.
3. Send the program to the background:
On Phone, switch to another app.
On PC, minimize the app.
4. The app continues to display toast notifications.
5. Bring the app back to the foreground to cause a revoke due to Resume.
6. Run the sample with debugging.
7. Repeat steps 2 through 4 above.
8. Use the Lifecycle events menu in the debugger to suspend the app.
This simulates a revoke due to SystemPolicy.

**Saving Data Extended Execution**:

1. Run the sample without debugging and go to the **Saving Data Reason** scenario.
2. Send the program to the background:
On Phone, switch to another app.
On PC, minimize the app.
3. The app displays toast notifications while the save operation proceeds,
demonstrating that the app was given a longer period of time to save data while suspending.

**Location Tracking Extended Execution**:

1. Run the sample without debugging and go to the **Location Tracking Reason** scenario.
2. Click **Begin Extended Execution**.
3. Send the program to the background:
On Phone, switch to another app.
On PC, minimize the app.
4. The app continues to report your location every 10 seconds.
5. Bring the app back to the foreground to cause a revoke due to Resume.
6. Run the sample with debugging.
7. Repeat steps 2 through 4 above.
8. Use the Lifecycle events menu in the debugger to suspend the app.
This simulates a revoke due to SystemPolicy.

## Read more

See the following topics for step-by-step information about using extended execution:

- [Background Tasks and Extended Execution](https://msdn.microsoft.com/en-us/magazine/mt590969)

181 changes: 181 additions & 0 deletions Samples/ExtendedExecution/cs/ExtendedExecution.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
<?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>{3DE0BD30-8F0D-4835-91C5-9EC6133B7B0F}</ProjectGuid>
<OutputType>AppContainerExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>SDKTemplate</RootNamespace>
<AssemblyName>ExtendedExecution</AssemblyName>
<DefaultLanguage>en-US</DefaultLanguage>
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
<TargetPlatformVersion>10.0.10240.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.10240.0</TargetPlatformMinVersion>
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
<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="..\..\..\SharedContent\cs\App.xaml.cs">
<Link>App.xaml.cs</Link>
<DependentUpon>App.xaml</DependentUpon>
</Compile>
<Compile Include="..\..\..\SharedContent\cs\MainPage.xaml.cs">
<Link>MainPage.xaml.cs</Link>
<DependentUpon>MainPage.xaml</DependentUpon>
</Compile>
<Compile Include="..\..\..\SharedContent\cs\AssemblyInfo.cs">
<Link>Properties\AssemblyInfo.cs</Link>
</Compile>
<Compile Include="SampleConfiguration.cs" />
<Compile Include="Scenario1_UnspecifiedReason.xaml.cs" />
<Compile Include="Scenario2_SavingDataReason.xaml.cs" />
<Compile Include="Scenario3_LocationTrackingReason.xaml.cs" />
</ItemGroup>
<ItemGroup>
<AppxManifest Include="Package.appxmanifest">
<SubType>Designer</SubType>
</AppxManifest>
</ItemGroup>
<ItemGroup>
<Content Include="..\..\..\SharedContent\media\microsoft-sdk.png">
<Link>Assets\microsoft-sdk.png</Link>
</Content>
<Content Include="..\..\..\SharedContent\media\smalltile-sdk.png">
<Link>Assets\smalltile-sdk.png</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\storelogo-sdk.png">
<Link>Assets\storelogo-sdk.png</Link>
</Content>
<Content Include="..\..\..\SharedContent\media\tile-sdk.png">
<Link>Assets\tile-sdk.png</Link>
</Content>
<Content Include="..\..\..\SharedContent\media\windows-sdk.png">
<Link>Assets\windows-sdk.png</Link>
</Content>
<Content Include="..\..\..\SharedContent\cs\Default.rd.xml">
<Link>Properties\Default.rd.xml</Link>
</Content>
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="..\..\..\SharedContent\xaml\App.xaml">
<Link>App.xaml</Link>
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Page Include="..\..\..\SharedContent\cs\MainPage.xaml">
<Link>MainPage.xaml</Link>
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Scenario1_UnspecifiedReason.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Scenario2_SavingDataReason.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Scenario3_LocationTrackingReason.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="..\..\..\SharedContent\xaml\Styles.xaml">
<Link>Styles\Styles.xaml</Link>
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '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>
40 changes: 40 additions & 0 deletions Samples/ExtendedExecution/cs/ExtendedExecution.sln
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}") = "ExtendedExecution", "ExtendedExecution.csproj", "{3DE0BD30-8F0D-4835-91C5-9EC6133B7B0F}"
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
{3DE0BD30-8F0D-4835-91C5-9EC6133B7B0F}.Debug|ARM.ActiveCfg = Debug|ARM
{3DE0BD30-8F0D-4835-91C5-9EC6133B7B0F}.Debug|ARM.Build.0 = Debug|ARM
{3DE0BD30-8F0D-4835-91C5-9EC6133B7B0F}.Debug|ARM.Deploy.0 = Debug|ARM
{3DE0BD30-8F0D-4835-91C5-9EC6133B7B0F}.Debug|x64.ActiveCfg = Debug|x64
{3DE0BD30-8F0D-4835-91C5-9EC6133B7B0F}.Debug|x64.Build.0 = Debug|x64
{3DE0BD30-8F0D-4835-91C5-9EC6133B7B0F}.Debug|x64.Deploy.0 = Debug|x64
{3DE0BD30-8F0D-4835-91C5-9EC6133B7B0F}.Debug|x86.ActiveCfg = Debug|x86
{3DE0BD30-8F0D-4835-91C5-9EC6133B7B0F}.Debug|x86.Build.0 = Debug|x86
{3DE0BD30-8F0D-4835-91C5-9EC6133B7B0F}.Debug|x86.Deploy.0 = Debug|x86
{3DE0BD30-8F0D-4835-91C5-9EC6133B7B0F}.Release|ARM.ActiveCfg = Release|ARM
{3DE0BD30-8F0D-4835-91C5-9EC6133B7B0F}.Release|ARM.Build.0 = Release|ARM
{3DE0BD30-8F0D-4835-91C5-9EC6133B7B0F}.Release|ARM.Deploy.0 = Release|ARM
{3DE0BD30-8F0D-4835-91C5-9EC6133B7B0F}.Release|x64.ActiveCfg = Release|x64
{3DE0BD30-8F0D-4835-91C5-9EC6133B7B0F}.Release|x64.Build.0 = Release|x64
{3DE0BD30-8F0D-4835-91C5-9EC6133B7B0F}.Release|x64.Deploy.0 = Release|x64
{3DE0BD30-8F0D-4835-91C5-9EC6133B7B0F}.Release|x86.ActiveCfg = Release|x86
{3DE0BD30-8F0D-4835-91C5-9EC6133B7B0F}.Release|x86.Build.0 = Release|x86
{3DE0BD30-8F0D-4835-91C5-9EC6133B7B0F}.Release|x86.Deploy.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
Loading

0 comments on commit 94d11a6

Please sign in to comment.