diff --git a/README.md b/README.md
index 9222bd0578..9cb14e277f 100644
--- a/README.md
+++ b/README.md
@@ -414,6 +414,7 @@ For additional Windows samples, see [Windows on GitHub](http://microsoft.github.
diff --git a/Samples/BasicInput/cs/3-DeviceCapabilities.xaml.cs b/Samples/BasicInput/cs/3-DeviceCapabilities.xaml.cs
index 597bd66085..d67813d861 100644
--- a/Samples/BasicInput/cs/3-DeviceCapabilities.xaml.cs
+++ b/Samples/BasicInput/cs/3-DeviceCapabilities.xaml.cs
@@ -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();
diff --git a/Samples/ExtendedExecution/README.md b/Samples/ExtendedExecution/README.md
new file mode 100644
index 0000000000..b5b61015f5
--- /dev/null
+++ b/Samples/ExtendedExecution/README.md
@@ -0,0 +1,117 @@
+
+
+# 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)
+
diff --git a/Samples/ExtendedExecution/cs/ExtendedExecution.csproj b/Samples/ExtendedExecution/cs/ExtendedExecution.csproj
new file mode 100644
index 0000000000..c2a9cfb2c5
--- /dev/null
+++ b/Samples/ExtendedExecution/cs/ExtendedExecution.csproj
@@ -0,0 +1,181 @@
+
+
+
+
+ Debug
+ x86
+ {3DE0BD30-8F0D-4835-91C5-9EC6133B7B0F}
+ AppContainerExe
+ Properties
+ SDKTemplate
+ ExtendedExecution
+ en-US
+ UAP
+ 10.0.10240.0
+ 10.0.10240.0
+ 14
+ 512
+ {A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
+
+
+ true
+ bin\x86\Debug\
+ DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP
+ ;2008
+ full
+ x86
+ false
+ prompt
+ true
+
+
+ bin\x86\Release\
+ TRACE;NETFX_CORE;WINDOWS_UWP
+ true
+ ;2008
+ pdbonly
+ x86
+ false
+ prompt
+ true
+ true
+
+
+ true
+ bin\ARM\Debug\
+ DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP
+ ;2008
+ full
+ ARM
+ false
+ prompt
+ true
+
+
+ bin\ARM\Release\
+ TRACE;NETFX_CORE;WINDOWS_UWP
+ true
+ ;2008
+ pdbonly
+ ARM
+ false
+ prompt
+ true
+ true
+
+
+ true
+ bin\x64\Debug\
+ DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP
+ ;2008
+ full
+ x64
+ false
+ prompt
+ true
+
+
+ bin\x64\Release\
+ TRACE;NETFX_CORE;WINDOWS_UWP
+ true
+ ;2008
+ pdbonly
+ x64
+ false
+ prompt
+ true
+ true
+
+
+
+
+
+
+
+ App.xaml.cs
+ App.xaml
+
+
+ MainPage.xaml.cs
+ MainPage.xaml
+
+
+ Properties\AssemblyInfo.cs
+
+
+
+
+
+
+
+
+ Designer
+
+
+
+
+ Assets\microsoft-sdk.png
+
+
+ Assets\smalltile-sdk.png
+
+
+ Assets\splash-sdk.png
+
+
+ Assets\squaretile-sdk.png
+
+
+ Assets\storelogo-sdk.png
+
+
+ Assets\tile-sdk.png
+
+
+ Assets\windows-sdk.png
+
+
+ Properties\Default.rd.xml
+
+
+
+
+ App.xaml
+ MSBuild:Compile
+ Designer
+
+
+ MainPage.xaml
+ MSBuild:Compile
+ Designer
+
+
+ Designer
+ MSBuild:Compile
+
+
+ Designer
+ MSBuild:Compile
+
+
+ Designer
+ MSBuild:Compile
+
+
+ Styles\Styles.xaml
+ Designer
+ MSBuild:Compile
+
+
+
+ 14.0
+
+
+
+
\ No newline at end of file
diff --git a/Samples/ExtendedExecution/cs/ExtendedExecution.sln b/Samples/ExtendedExecution/cs/ExtendedExecution.sln
new file mode 100644
index 0000000000..427869a37d
--- /dev/null
+++ b/Samples/ExtendedExecution/cs/ExtendedExecution.sln
@@ -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
diff --git a/Samples/ExtendedExecution/cs/Package.appxmanifest b/Samples/ExtendedExecution/cs/Package.appxmanifest
new file mode 100644
index 0000000000..ee9d746236
--- /dev/null
+++ b/Samples/ExtendedExecution/cs/Package.appxmanifest
@@ -0,0 +1,43 @@
+
+
+
+
+
+ Extended Execution C# Sample
+ Microsoft Corporation
+ Assets\StoreLogo-sdk.png
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Samples/ExtendedExecution/cs/SampleConfiguration.cs b/Samples/ExtendedExecution/cs/SampleConfiguration.cs
new file mode 100644
index 0000000000..0118d44c5f
--- /dev/null
+++ b/Samples/ExtendedExecution/cs/SampleConfiguration.cs
@@ -0,0 +1,64 @@
+//*********************************************************
+//
+// Copyright (c) Microsoft. All rights reserved.
+// This code is licensed under the MIT License (MIT).
+// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
+// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
+// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
+// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
+//
+//*********************************************************
+
+using System;
+using System.Collections.Generic;
+using Windows.Data.Xml.Dom;
+using Windows.UI.Notifications;
+using Windows.UI.Xaml.Controls;
+
+
+namespace SDKTemplate
+{
+ public partial class MainPage : Page
+ {
+ public const string FEATURE_NAME = "Extended Execution";
+
+ List scenarios = new List
+ {
+ new Scenario() { Title="Unspecified Reason", ClassType=typeof(UnspecifiedReason)},
+ new Scenario() { Title="Saving Data Reason", ClassType=typeof(SavingDataReason)},
+ new Scenario() { Title="Location Tracking Reason", ClassType=typeof(LocationTrackingReason)},
+ };
+
+ public static ToastNotification DisplayToast(string content)
+ {
+ string xml = $@"
+
+
+ Extended Execution
+
+
+ ";
+
+ XmlDocument doc = new XmlDocument();
+ doc.LoadXml(xml);
+
+ var binding = doc.SelectSingleNode("//binding");
+
+ var el = doc.CreateElement("text");
+ el.InnerText = content;
+ binding.AppendChild(el); //Add content to notification
+
+ var toast = new ToastNotification(doc);
+
+ ToastNotificationManager.CreateToastNotifier().Show(toast); //Show the toast
+
+ return toast;
+ }
+ }
+
+ public class Scenario
+ {
+ public string Title { get; set; }
+ public Type ClassType { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/Samples/ExtendedExecution/cs/Scenario1_UnspecifiedReason.xaml b/Samples/ExtendedExecution/cs/Scenario1_UnspecifiedReason.xaml
new file mode 100644
index 0000000000..fd8c3cf214
--- /dev/null
+++ b/Samples/ExtendedExecution/cs/Scenario1_UnspecifiedReason.xaml
@@ -0,0 +1,41 @@
+
+
+
+
+
+
+
+
+
+ Requests for extended execution using the "Unspecified" reason
+ are allowed only during the Resumed lifecycle stage.
+ The app raises a toast every ten seconds to demonstrate that it is still running.
+
+
+
+
+ Extended execution:
+
+
+ See the instructions in the README for details on how to use this scenario.
+
+
+
+
diff --git a/Samples/ExtendedExecution/cs/Scenario1_UnspecifiedReason.xaml.cs b/Samples/ExtendedExecution/cs/Scenario1_UnspecifiedReason.xaml.cs
new file mode 100644
index 0000000000..db0068e9b9
--- /dev/null
+++ b/Samples/ExtendedExecution/cs/Scenario1_UnspecifiedReason.xaml.cs
@@ -0,0 +1,142 @@
+
+//*********************************************************
+//
+// Copyright (c) Microsoft. All rights reserved.
+// This code is licensed under the MIT License (MIT).
+// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
+// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
+// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
+// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
+//
+//*********************************************************
+
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+using Windows.ApplicationModel.ExtendedExecution;
+using Windows.UI.Core;
+using Windows.UI.Xaml;
+using Windows.UI.Xaml.Controls;
+using Windows.UI.Xaml.Navigation;
+
+namespace SDKTemplate
+{
+ ///
+ /// Page containing the Extended Execution Unspecified Reason scenario functions.
+ ///
+ public sealed partial class UnspecifiedReason : Page
+ {
+ // A pointer back to the main page. This is needed if you want to call methods in MainPage such
+ // as NotifyUser()
+ private MainPage rootPage = MainPage.Current;
+
+ private ExtendedExecutionSession session = null;
+ private Timer periodicTimer = null;
+
+ public UnspecifiedReason()
+ {
+ this.InitializeComponent();
+ }
+
+ protected override void OnNavigatingFrom(NavigatingCancelEventArgs e)
+ {
+ // End the Extended Execution Session.
+ // Only one extended execution session can be held by an application at one time.
+ ClearExtendedExecution();
+ }
+
+ void ClearExtendedExecution()
+ {
+ if (session != null)
+ {
+ session.Revoked -= SessionRevoked;
+ session.Dispose();
+ session = null;
+ }
+
+ if (periodicTimer != null)
+ {
+ periodicTimer.Dispose();
+ periodicTimer = null;
+ }
+ }
+
+ private void UpdateUI()
+ {
+ if (session == null)
+ {
+ Status.Text = "Not requested";
+ RequestButton.IsEnabled = true;
+ CloseButton.IsEnabled = false;
+ }
+ else
+ {
+ Status.Text = "Requested";
+ RequestButton.IsEnabled = false;
+ CloseButton.IsEnabled = true;
+ }
+ }
+
+ private async void BeginExtendedExecution()
+ {
+ // The previous Extended Execution must be closed before a new one can be requested.
+ // This code is redundant here because the sample doesn't allow a new extended
+ // execution to begin until the previous one ends, but we leave it here for illustration.
+ ClearExtendedExecution();
+
+ var newSession = new ExtendedExecutionSession();
+ newSession.Reason = ExtendedExecutionReason.Unspecified;
+ newSession.Description = "Raising periodic toasts";
+ newSession.Revoked += SessionRevoked;
+ ExtendedExecutionResult result = await newSession.RequestExtensionAsync();
+
+ switch (result)
+ {
+ case ExtendedExecutionResult.Allowed:
+ rootPage.NotifyUser("Extended execution allowed.", NotifyType.StatusMessage);
+ session = newSession;
+ periodicTimer = new Timer(OnTimer, DateTime.Now, TimeSpan.FromSeconds(2), TimeSpan.FromSeconds(10));
+ break;
+
+ default:
+ case ExtendedExecutionResult.Denied:
+ rootPage.NotifyUser("Extended execution denied.", NotifyType.ErrorMessage);
+ newSession.Dispose();
+ break;
+ }
+ UpdateUI();
+ }
+
+ private void OnTimer(object state)
+ {
+ var startTime = (DateTime)state;
+ var runningTime = Math.Round((DateTime.Now - startTime).TotalSeconds, 0);
+ MainPage.DisplayToast($"Extended execution has been active for {runningTime} seconds");
+ }
+
+ private void EndExtendedExecution()
+ {
+ ClearExtendedExecution();
+ UpdateUI();
+ }
+
+ private async void SessionRevoked(object sender, ExtendedExecutionRevokedEventArgs args)
+ {
+ await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
+ {
+ switch (args.Reason)
+ {
+ case ExtendedExecutionRevokedReason.Resumed:
+ rootPage.NotifyUser("Extended execution revoked due to returning to foreground.", NotifyType.StatusMessage);
+ break;
+
+ case ExtendedExecutionRevokedReason.SystemPolicy:
+ rootPage.NotifyUser("Extended execution revoked due to system policy.", NotifyType.StatusMessage);
+ break;
+ }
+
+ EndExtendedExecution();
+ });
+ }
+ }
+}
diff --git a/Samples/ExtendedExecution/cs/Scenario2_SavingDataReason.xaml b/Samples/ExtendedExecution/cs/Scenario2_SavingDataReason.xaml
new file mode 100644
index 0000000000..8f0d59f45e
--- /dev/null
+++ b/Samples/ExtendedExecution/cs/Scenario2_SavingDataReason.xaml
@@ -0,0 +1,36 @@
+
+
+
+
+
+
+
+
+ Requests for extended execution using the "SavingData" reason
+ are allowed only during the Suspending lifecycle stage.
+ The app raises a toast every ten seconds during the save operation
+ to demonstrate that it is still running.
+
+
+ See the instructions in the README for details on how to use this scenario.
+
+
+
+
diff --git a/Samples/ExtendedExecution/cs/Scenario2_SavingDataReason.xaml.cs b/Samples/ExtendedExecution/cs/Scenario2_SavingDataReason.xaml.cs
new file mode 100644
index 0000000000..ce6172f055
--- /dev/null
+++ b/Samples/ExtendedExecution/cs/Scenario2_SavingDataReason.xaml.cs
@@ -0,0 +1,103 @@
+
+//*********************************************************
+//
+// Copyright (c) Microsoft. All rights reserved.
+// This code is licensed under the MIT License (MIT).
+// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
+// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
+// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
+// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
+//
+//*********************************************************
+
+using System;
+using System.Threading.Tasks;
+using Windows.ApplicationModel;
+using Windows.ApplicationModel.ExtendedExecution;
+using Windows.UI.Core;
+using Windows.UI.Xaml;
+using Windows.UI.Xaml.Controls;
+using Windows.UI.Xaml.Navigation;
+
+namespace SDKTemplate
+{
+ ///
+ /// Page containing the Extended Execution SavingData Reason scenario functions.
+ ///
+ public sealed partial class SavingDataReason : Page
+ {
+ private MainPage rootPage = MainPage.Current;
+
+ public SavingDataReason()
+ {
+ this.InitializeComponent();
+ }
+
+ protected override void OnNavigatedTo(NavigationEventArgs e)
+ {
+ // Add a suspension handler in order to request a SavingData Extended Execution.
+ App.Current.Suspending += OnSuspending;
+ }
+
+ protected override void OnNavigatingFrom(NavigatingCancelEventArgs e)
+ {
+ App.Current.Suspending -= OnSuspending;
+ }
+
+ private async void OnSuspending(object sender, SuspendingEventArgs args)
+ {
+ SuspendingDeferral suspendDeferral = args.SuspendingOperation.GetDeferral();
+
+ rootPage.NotifyUser("", NotifyType.StatusMessage);
+
+ using (var session = new ExtendedExecutionSession())
+ {
+ session.Reason = ExtendedExecutionReason.SavingData;
+ session.Description = "Pretending to save data to slow storage.";
+ session.Revoked += ExtendedExecutionSessionRevoked;
+
+ ExtendedExecutionResult result = await session.RequestExtensionAsync();
+ switch (result)
+ {
+ case ExtendedExecutionResult.Allowed:
+ // We can perform a longer save operation (e.g., upload to the cloud).
+ MainPage.DisplayToast("Performing a long save operation.");
+ await Task.Delay(TimeSpan.FromSeconds(10));
+ MainPage.DisplayToast("Still saving.");
+ await Task.Delay(TimeSpan.FromSeconds(10));
+ MainPage.DisplayToast("Long save complete.");
+ break;
+
+ default:
+ case ExtendedExecutionResult.Denied:
+ // We must perform a fast save operation.
+ MainPage.DisplayToast("Performing a fast save operation.");
+ await Task.Delay(TimeSpan.FromSeconds(1));
+ MainPage.DisplayToast("Fast save complete.");
+ break;
+ }
+
+ session.Revoked -= ExtendedExecutionSessionRevoked;
+ }
+
+ suspendDeferral.Complete();
+ }
+
+ private async void ExtendedExecutionSessionRevoked(object sender, ExtendedExecutionRevokedEventArgs args)
+ {
+ await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
+ {
+ switch (args.Reason)
+ {
+ case ExtendedExecutionRevokedReason.Resumed:
+ rootPage.NotifyUser("Extended execution revoked due to returning to foreground.", NotifyType.StatusMessage);
+ break;
+
+ case ExtendedExecutionRevokedReason.SystemPolicy:
+ rootPage.NotifyUser("Extended execution revoked due to system policy.", NotifyType.StatusMessage);
+ break;
+ }
+ });
+ }
+ }
+}
diff --git a/Samples/ExtendedExecution/cs/Scenario3_LocationTrackingReason.xaml b/Samples/ExtendedExecution/cs/Scenario3_LocationTrackingReason.xaml
new file mode 100644
index 0000000000..43aee57d0c
--- /dev/null
+++ b/Samples/ExtendedExecution/cs/Scenario3_LocationTrackingReason.xaml
@@ -0,0 +1,41 @@
+
+
+
+
+
+
+
+
+ Requests for extended execution using the "LocationTracking" reason
+ are allowed only during the Resumed lifecycle stage.
+ If extended execution is allowed, then the app continues to report your location
+ even when in the background.
+
+
+
+
+ Extended execution:
+
+
+ See the instructions in the README for details on how to use this scenario.
+
+
+
+
diff --git a/Samples/ExtendedExecution/cs/Scenario3_LocationTrackingReason.xaml.cs b/Samples/ExtendedExecution/cs/Scenario3_LocationTrackingReason.xaml.cs
new file mode 100644
index 0000000000..440ce74c2d
--- /dev/null
+++ b/Samples/ExtendedExecution/cs/Scenario3_LocationTrackingReason.xaml.cs
@@ -0,0 +1,188 @@
+
+//*********************************************************
+//
+// Copyright (c) Microsoft. All rights reserved.
+// This code is licensed under the MIT License (MIT).
+// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
+// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
+// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
+// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
+//
+//*********************************************************
+
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+using Windows.ApplicationModel.ExtendedExecution;
+using Windows.Devices.Geolocation;
+using Windows.UI.Core;
+using Windows.UI.Xaml.Controls;
+using Windows.UI.Xaml.Navigation;
+
+namespace SDKTemplate
+{
+ ///
+ /// Page containing the Extended Execution LocationTracking Reason scenario functions.
+ ///
+ public sealed partial class LocationTrackingReason : Page
+ {
+ private MainPage rootPage = MainPage.Current;
+
+ ExtendedExecutionSession session = null;
+ private Timer periodicTimer = null;
+
+ public LocationTrackingReason()
+ {
+ this.InitializeComponent();
+ }
+
+ protected override void OnNavigatingFrom(NavigatingCancelEventArgs e)
+ {
+ // End the Extended Execution Session.
+ // Only one extended execution session can be held by an application at one time.
+ ClearExtendedExecution();
+ }
+
+ void ClearExtendedExecution()
+ {
+ if (session != null)
+ {
+ session.Revoked -= SessionRevoked;
+ session.Dispose();
+ session = null;
+ }
+
+ if (periodicTimer != null)
+ {
+ periodicTimer.Dispose();
+ periodicTimer = null;
+ }
+ }
+
+ private void UpdateUI()
+ {
+ if (session == null)
+ {
+ Status.Text = "Not requested";
+ RequestButton.IsEnabled = true;
+ CloseButton.IsEnabled = false;
+ }
+ else
+ {
+ Status.Text = "Requested";
+ RequestButton.IsEnabled = false;
+ CloseButton.IsEnabled = true;
+ }
+ }
+
+ private async Task StartLocationTrackingAsync()
+ {
+ Geolocator geolocator = null;
+
+ // Request permission to access location
+ var accessStatus = await Geolocator.RequestAccessAsync();
+
+ switch (accessStatus)
+ {
+ case GeolocationAccessStatus.Allowed:
+ // See the Geolocation sample for more information on using the Geolocator class.
+ geolocator = new Geolocator { ReportInterval = 2000 };
+ break;
+
+ case GeolocationAccessStatus.Denied:
+ rootPage.NotifyUser("Access to location is denied.", NotifyType.ErrorMessage);
+ break;
+
+ default:
+ case GeolocationAccessStatus.Unspecified:
+ rootPage.NotifyUser("Couldn't access the geolocator.", NotifyType.ErrorMessage);
+ break;
+ }
+
+ return geolocator;
+ }
+
+ private async void BeginExtendedExecution()
+ {
+ // The previous Extended Execution must be closed before a new one can be requested.
+ // This code is redundant here because the sample doesn't allow a new extended
+ // execution to begin until the previous one ends, but we leave it here for illustration.
+ ClearExtendedExecution();
+
+ var newSession = new ExtendedExecutionSession();
+ newSession.Reason = ExtendedExecutionReason.Unspecified;
+ newSession.Description = "Tracking your location";
+ newSession.Revoked += SessionRevoked;
+ ExtendedExecutionResult result = await newSession.RequestExtensionAsync();
+
+ switch (result)
+ {
+ case ExtendedExecutionResult.Allowed:
+ rootPage.NotifyUser("Extended execution allowed.", NotifyType.StatusMessage);
+ session = newSession;
+ Geolocator geolocator = await StartLocationTrackingAsync();
+ periodicTimer = new Timer(OnTimer, geolocator, TimeSpan.FromSeconds(2), TimeSpan.FromSeconds(10));
+ break;
+
+ default:
+ case ExtendedExecutionResult.Denied:
+ rootPage.NotifyUser("Extended execution denied.", NotifyType.ErrorMessage);
+ newSession.Dispose();
+ break;
+ }
+ UpdateUI();
+ }
+
+ private async void OnTimer(object state)
+ {
+ await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, async () =>
+ {
+ var geolocator = (Geolocator)state;
+ string message;
+ if (geolocator == null)
+ {
+ message = "No geolocator";
+ }
+ else
+ {
+ Geoposition geoposition = await geolocator.GetGeopositionAsync();
+ if (geoposition == null)
+ {
+ message = "Cannot get current location";
+ }
+ else
+ {
+ BasicGeoposition basicPosition = geoposition.Coordinate.Point.Position;
+ message = $"Longitude = {basicPosition.Longitude}, Latitude = {basicPosition.Latitude}";
+ }
+ }
+ MainPage.DisplayToast(message);
+ });
+ }
+
+ private void EndExtendedExecution()
+ {
+ ClearExtendedExecution();
+ UpdateUI();
+ }
+
+ private async void SessionRevoked(object sender, ExtendedExecutionRevokedEventArgs args)
+ {
+ await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
+ {
+ switch (args.Reason)
+ {
+ case ExtendedExecutionRevokedReason.Resumed:
+ rootPage.NotifyUser("Extended execution revoked due to returning to foreground.", NotifyType.StatusMessage);
+ break;
+
+ case ExtendedExecutionRevokedReason.SystemPolicy:
+ rootPage.NotifyUser("Extended execution revoked due to system policy.", NotifyType.StatusMessage);
+ break;
+ }
+
+ EndExtendedExecution();
+ });
+ }
+ }
+}
diff --git a/Samples/ExtendedExecution/cs/project.json b/Samples/ExtendedExecution/cs/project.json
new file mode 100644
index 0000000000..c594939270
--- /dev/null
+++ b/Samples/ExtendedExecution/cs/project.json
@@ -0,0 +1,16 @@
+{
+ "dependencies": {
+ "Microsoft.NETCore.UniversalWindowsPlatform": "5.0.0"
+ },
+ "frameworks": {
+ "uap10.0": {}
+ },
+ "runtimes": {
+ "win10-arm": {},
+ "win10-arm-aot": {},
+ "win10-x86": {},
+ "win10-x86-aot": {},
+ "win10-x64": {},
+ "win10-x64-aot": {}
+ }
+}
\ No newline at end of file
diff --git a/Samples/VideoPlayback/README.md b/Samples/VideoPlayback/README.md
index a1419de784..107fe48c16 100644
--- a/Samples/VideoPlayback/README.md
+++ b/Samples/VideoPlayback/README.md
@@ -22,7 +22,7 @@ There are some scenarios that are not available in the JS version but they will
Related topics
--------------
-[Windows.Media.Playback namespace] https://msdn.microsoft.com/en-us/library/windows/apps/windows.media.playback.aspx
+[Windows.Media.Playback namespace](https://msdn.microsoft.com/en-us/library/windows/apps/windows.media.playback.aspx)
System requirements
-----------------------------
diff --git a/Samples/WebAccountManagement/README.md b/Samples/WebAccountManagement/README.md
index 561b6839bd..0be244ddb0 100644
--- a/Samples/WebAccountManagement/README.md
+++ b/Samples/WebAccountManagement/README.md
@@ -25,9 +25,14 @@ To obtain information about Microsoft Visual Studio 2015 and the tools for devel
## Related topics
-Registration of application to use a Microsoft account [Preparing your account to use Windows Live Services in your Windows Store apps](https://msdn.microsoft.com/en-us/library/windows/apps/xaml/hh770854.aspx)
+Registration of application to use a Microsoft account:
+[Preparing your account to use Windows Live Services in your Windows Store apps](https://msdn.microsoft.com/en-us/library/windows/apps/xaml/hh770854.aspx)
-Configuring an application to authorize with Azure Active Directory (https://auth0.com/docs/connections/enterprise/azure-active-directory)
+Develop Windows Universal Apps with Azure AD and the Windows 10 Identity API:
+[Using WebAccountManager to Integrate with Azure AD](http://blogs.technet.com/b/ad/archive/2015/08/03/develop-windows-universal-apps-with-azure-ad-and-the-windows-10-identity-api.aspx)
+
+Azure sample:
+[Universal Windows Platform app calling the directory Graph API](https://github.com/Azure-Samples/active-directory-dotnet-native-uwp-wam/tree/master/NativeClient-UWP-WAM/)
### Reference
diff --git a/Samples/WindowsAudioSession/README.md b/Samples/WindowsAudioSession/README.md
index cb19f6f1d6..f7cafa3dd5 100644
--- a/Samples/WindowsAudioSession/README.md
+++ b/Samples/WindowsAudioSession/README.md
@@ -1,4 +1,4 @@
-
@@ -18,9 +18,20 @@ Specifically, this sample covers:
For more information on adding audio to your Windows Store app, see [Quickstart: adding audio to an app](http://msdn.microsoft.com/library/windows/apps/hh452730).
+Playing audio in the background is supported by the Windows Audio Session API
+only in communication scenarios as demonstrated by the [VoIP](/Samples/VoIP) sample.
+Instead, for general background audio playback of media,
+use the BackgroundMediaPlayer class demonstrated in the [Background Audio](/Samples/BackgroundAudio) sample.
+
## Related topics
-**Roadmaps**
+### Samples
+
+[Background Audio](/Samples/BackgroundAudio)
+
+[VoIP](/Samples/VoIP)
+
+### Roadmaps
[Audio, video, and camera](https://msdn.microsoft.com/library/windows/apps/mt203788)
@@ -32,7 +43,7 @@ For more information on adding audio to your Windows Store app, see [Quickstart:
[Roadmap for apps using JavaScript](http://msdn.microsoft.com/library/windows/apps/hh465037)
-**Reference**
+### Reference
[Windows Audio Session API (WASAPI)](http://msdn.microsoft.com/library/windows/apps/dd371455)
diff --git a/Samples/XamlUIBasics/cs/AppUIBasics/ControlPages/SemanticZoomPage.xaml b/Samples/XamlUIBasics/cs/AppUIBasics/ControlPages/SemanticZoomPage.xaml
index de4a941766..bf6e2cc054 100644
--- a/Samples/XamlUIBasics/cs/AppUIBasics/ControlPages/SemanticZoomPage.xaml
+++ b/Samples/XamlUIBasics/cs/AppUIBasics/ControlPages/SemanticZoomPage.xaml
@@ -72,7 +72,7 @@
<SemanticZoom.ZoomedOutView><ListView ItemsSource="{x:Bind cvsGroups.View.CollectionGroups}" HorizontalAlignment="Stretch"
- SelectionMode="None" ItemTemplate="{StaticResource ZoomedOutTemplate}" /gt;
+ SelectionMode="None" ItemTemplate="{StaticResource ZoomedOutTemplate}" /></SemanticZoom.ZoomedOutView></SemanticZoom>