Skip to content

Commit

Permalink
Windows 11 - May 2022 Samples Update
Browse files Browse the repository at this point in the history
* ApplicationData: Remove roaming scenarios that don't apply to Windows 11
* Geolocation: Add geometric and time dilution of position properties
* WindowsAudioSession: Fix buffer leaks, waveformat leaks, low latency, hardware offload, handle systems with no sound device
* UserInfo: New CheckUserAgeConsentGroupAsync method
* ApplicationData, PasswordVault, WindowsAudioSession: Ported to C++/WinRT
  • Loading branch information
oldnewthing committed May 19, 2022
1 parent 7b34a9f commit 589f33b
Show file tree
Hide file tree
Showing 167 changed files with 8,411 additions and 1,290 deletions.
25 changes: 13 additions & 12 deletions Samples/ApplicationData/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
page_type: sample
languages:
- csharp
- vb
- cpp
- cppwinrt
products:
- windows
- windows-uwp
Expand Down Expand Up @@ -37,41 +38,41 @@ Shows how to store and retrieve data that is specific to each user and app by us
Application data includes session state, user preferences, and other settings. It is created, read, updated, and deleted when the app is running. The operating system manages these data stores for your app:

- local: Data that exists on the current device and is backed up in the cloud
- roaming: Data that exists on all devices on which the user has installed the app
- temporary: Data that could be removed by the system any time the app isn't running
- localcache: Persistent data that exists only on the current device

If you use roaming data in your app, your users can easily keep your app's application data in sync across multiple devices. The operating system replicates roaming data to the cloud when it is updated, and synchronizes the data to any other devices on which the app is installed, reducing the amount of setup work that the user needs to do to install your app on multiple devices.

If you use local data in your app, your users can back up application data in the cloud. This application data can then be restored back on any other device while setting up the device with the same account.

The system also manages a roaming data store,
but the data no longer roams starting in Windows 11.

The sample covers these key tasks:

- Reading and writing settings to an app data store
- Reading and writing files to an app data store
- Responding to roaming events

## Guidelines

[Guidelines for roaming application data](http://msdn.microsoft.com/library/windows/apps/hh465094)
## Related topics

## Concepts
### Concepts

[Store and retrieve settings and other app data](https://msdn.microsoft.com/library/windows/apps/mt299098)

## Reference
### Related samples

* [ApplicationData sample](/archived/ApplicationData/) for Visual Basic (archived)

### Reference

[Windows.Storage.ApplicationData](http://msdn.microsoft.com/library/windows/apps/br241587)
[Windows.Storage.ApplicationDataCompositeValue](http://msdn.microsoft.com/library/windows/apps/br241588)
[Windows.Storage.ApplicationDataContainer](http://msdn.microsoft.com/library/windows/apps/br241599)
[Windows.Storage.ApplicationDataContainerSettings](http://msdn.microsoft.com/library/windows/apps/br241600)
[WinJS.Application](http://msdn.microsoft.com/library/windows/apps/br229774)

## System requirements

**Client:** Windows 10

**Server:** Windows Server 2016 Technical Preview
**Server:** Windows Server 2016

**Phone:** Windows 10

Expand Down
43 changes: 43 additions & 0 deletions Samples/ApplicationData/cppwinrt/ApplicationData.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.31424.327
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ApplicationData", "ApplicationData.vcxproj", "{83665FC5-1A28-4FF1-A403-2A7ACBA3E6A5}"
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
{83665FC5-1A28-4FF1-A403-2A7ACBA3E6A5}.Debug|ARM.ActiveCfg = Debug|ARM
{83665FC5-1A28-4FF1-A403-2A7ACBA3E6A5}.Debug|ARM.Build.0 = Debug|ARM
{83665FC5-1A28-4FF1-A403-2A7ACBA3E6A5}.Debug|ARM.Deploy.0 = Debug|ARM
{83665FC5-1A28-4FF1-A403-2A7ACBA3E6A5}.Debug|x64.ActiveCfg = Debug|x64
{83665FC5-1A28-4FF1-A403-2A7ACBA3E6A5}.Debug|x64.Build.0 = Debug|x64
{83665FC5-1A28-4FF1-A403-2A7ACBA3E6A5}.Debug|x64.Deploy.0 = Debug|x64
{83665FC5-1A28-4FF1-A403-2A7ACBA3E6A5}.Debug|x86.ActiveCfg = Debug|Win32
{83665FC5-1A28-4FF1-A403-2A7ACBA3E6A5}.Debug|x86.Build.0 = Debug|Win32
{83665FC5-1A28-4FF1-A403-2A7ACBA3E6A5}.Debug|x86.Deploy.0 = Debug|Win32
{83665FC5-1A28-4FF1-A403-2A7ACBA3E6A5}.Release|ARM.ActiveCfg = Release|ARM
{83665FC5-1A28-4FF1-A403-2A7ACBA3E6A5}.Release|ARM.Build.0 = Release|ARM
{83665FC5-1A28-4FF1-A403-2A7ACBA3E6A5}.Release|ARM.Deploy.0 = Release|ARM
{83665FC5-1A28-4FF1-A403-2A7ACBA3E6A5}.Release|x64.ActiveCfg = Release|x64
{83665FC5-1A28-4FF1-A403-2A7ACBA3E6A5}.Release|x64.Build.0 = Release|x64
{83665FC5-1A28-4FF1-A403-2A7ACBA3E6A5}.Release|x64.Deploy.0 = Release|x64
{83665FC5-1A28-4FF1-A403-2A7ACBA3E6A5}.Release|x86.ActiveCfg = Release|Win32
{83665FC5-1A28-4FF1-A403-2A7ACBA3E6A5}.Release|x86.Build.0 = Release|Win32
{83665FC5-1A28-4FF1-A403-2A7ACBA3E6A5}.Release|x86.Deploy.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {391ED8DE-38FA-49C2-A23C-4D0CE73F0017}
EndGlobalSection
EndGlobal
253 changes: 253 additions & 0 deletions Samples/ApplicationData/cppwinrt/ApplicationData.vcxproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,253 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="packages\Microsoft.Windows.CppWinRT.2.0.210629.4\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('packages\Microsoft.Windows.CppWinRT.2.0.210629.4\build\native\Microsoft.Windows.CppWinRT.props')" />
<PropertyGroup>
<SharedContentDir>$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), LICENSE))\SharedContent</SharedContentDir>
</PropertyGroup>
<PropertyGroup Label="Globals">
<MinimalCoreWin>true</MinimalCoreWin>
<ProjectGuid>{83665FC5-1A28-4FF1-A403-2A7ACBA3E6A5}</ProjectGuid>
<ProjectName>ApplicationData</ProjectName>
<RootNamespace>SDKTemplate</RootNamespace>
<DefaultLanguage>en-US</DefaultLanguage>
<MinimumVisualStudioVersion>15.0</MinimumVisualStudioVersion>
<AppContainerApplication>true</AppContainerApplication>
<ApplicationType>Windows Store</ApplicationType>
<ApplicationTypeRevision>10.0</ApplicationTypeRevision>
<WindowsTargetPlatformVersion>10.0.22000.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformMinVersion>$(WindowsTargetPlatformVersion)</WindowsTargetPlatformMinVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|ARM">
<Configuration>Debug</Configuration>
<Platform>ARM</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|ARM">
<Configuration>Release</Configuration>
<Platform>ARM</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Debug'" Label="Configuration">
<UseDebugLibraries>true</UseDebugLibraries>
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Release'" Label="Configuration">
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<IncludePath>$(VC_IncludePath);$(UniversalCRT_IncludePath);$(WindowsSDK_IncludePath);$(SharedContentDir)\cppwinrt</IncludePath>
<CppWinRTOptimized>true</CppWinRTOptimized>
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>$(IntDir)pch.pch</PrecompiledHeaderOutputFile>
<WarningLevel>Level4</WarningLevel>
<AdditionalOptions>%(AdditionalOptions) /bigobj</AdditionalOptions>
<DisableSpecificWarnings>4453;28204</DisableSpecificWarnings>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'">
<ClCompile>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<AdditionalDependencies Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">WindowsApp.lib;onecoreuap.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<Link>
<AdditionalDependencies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">WindowsApp.lib;onecoreuap.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<Link>
<AdditionalDependencies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">WindowsApp.lib;onecoreuap.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)'=='Release'">
<ClCompile>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<AdditionalDependencies Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">WindowsApp.lib;onecoreuap.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<Link>
<AdditionalDependencies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WindowsApp.lib;onecoreuap.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<Link>
<AdditionalDependencies Condition="'$(Configuration)|$(Platform)'=='Release|x64'">WindowsApp.lib;onecoreuap.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="$(SharedContentDir)\cppwinrt\App.h">
<DependentUpon>$(SharedContentDir)\xaml\App.xaml</DependentUpon>
</ClInclude>
<ClInclude Include="$(SharedContentDir)\cppwinrt\MainPage.h">
<DependentUpon>$(SharedContentDir)\xaml\MainPage.xaml</DependentUpon>
</ClInclude>
<ClInclude Include="SampleConfiguration.h" />
<ClInclude Include="Scenario1_Files.h">
<DependentUpon>..\shared\Scenario1_Files.xaml</DependentUpon>
</ClInclude>
<ClInclude Include="Scenario2_Settings.h">
<DependentUpon>..\shared\Scenario2_Settings.xaml</DependentUpon>
</ClInclude>
<ClInclude Include="Scenario3_SettingContainer.h">
<DependentUpon>..\shared\Scenario3_SettingContainer.xaml</DependentUpon>
</ClInclude>
<ClInclude Include="Scenario4_CompositeSettings.h">
<DependentUpon>..\shared\Scenario4_CompositeSettings.xaml</DependentUpon>
</ClInclude>
<ClInclude Include="Scenario5_Msappdata.h">
<DependentUpon>..\shared\Scenario5_Msappdata.xaml</DependentUpon>
</ClInclude>
<ClInclude Include="Scenario6_ClearScenario.h">
<DependentUpon>..\shared\Scenario6_ClearScenario.xaml</DependentUpon>
</ClInclude>
<ClInclude Include="Scenario7_SetVersion.h">
<DependentUpon>..\shared\Scenario7_SetVersion.xaml</DependentUpon>
</ClInclude>
<ClInclude Include="pch.h" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="$(SharedContentDir)\xaml\App.xaml">
<SubType>Designer</SubType>
</ApplicationDefinition>
<Page Include="$(SharedContentDir)\xaml\MainPage.xaml">
<SubType>Designer</SubType>
</Page>
<Page Include="..\shared\Scenario1_Files.xaml" />
<Page Include="..\shared\Scenario2_Settings.xaml" />
<Page Include="..\shared\Scenario3_SettingContainer.xaml" />
<Page Include="..\shared\Scenario4_CompositeSettings.xaml" />
<Page Include="..\shared\Scenario5_Msappdata.xaml" />
<Page Include="..\shared\Scenario6_ClearScenario.xaml" />
<Page Include="..\shared\Scenario7_SetVersion.xaml" />
<Page Include="$(SharedContentDir)\xaml\Styles.xaml">
<Link>Styles\Styles.xaml</Link>
</Page>
</ItemGroup>
<ItemGroup>
<ClCompile Include="$(SharedContentDir)\cppwinrt\App.cpp">
<DependentUpon>$(SharedContentDir)\xaml\App.xaml</DependentUpon>
</ClCompile>
<ClCompile Include="$(SharedContentDir)\cppwinrt\MainPage.cpp">
<DependentUpon>$(SharedContentDir)\xaml\MainPage.xaml</DependentUpon>
</ClCompile>
<ClCompile Include="SampleConfiguration.cpp">
<DependentUpon>SampleConfiguration.h</DependentUpon>
</ClCompile>
<ClCompile Include="Scenario1_Files.cpp">
<DependentUpon>..\shared\Scenario1_Files.xaml</DependentUpon>
</ClCompile>
<ClCompile Include="Scenario2_Settings.cpp">
<DependentUpon>..\shared\Scenario2_Settings.xaml</DependentUpon>
</ClCompile>
<ClCompile Include="Scenario3_SettingContainer.cpp">
<DependentUpon>..\shared\Scenario3_SettingContainer.xaml</DependentUpon>
</ClCompile>
<ClCompile Include="Scenario4_CompositeSettings.cpp">
<DependentUpon>..\shared\Scenario4_CompositeSettings.xaml</DependentUpon>
</ClCompile>
<ClCompile Include="Scenario5_Msappdata.cpp">
<DependentUpon>..\shared\Scenario5_Msappdata.xaml</DependentUpon>
</ClCompile>
<ClCompile Include="Scenario6_ClearScenario.cpp">
<DependentUpon>..\shared\Scenario6_ClearScenario.xaml</DependentUpon>
</ClCompile>
<ClCompile Include="Scenario7_SetVersion.cpp">
<DependentUpon>..\shared\Scenario7_SetVersion.xaml</DependentUpon>
</ClCompile>
<ClCompile Include="pch.cpp">
<PrecompiledHeader>Create</PrecompiledHeader>
<DependentUpon>pch.h</DependentUpon>
</ClCompile>
<ClCompile Include="$(GeneratedFilesDir)module.g.cpp">
<DependentUpon>Project.idl</DependentUpon>
</ClCompile>
</ItemGroup>
<ItemGroup>
<Midl Include="$(SharedContentDir)\cppwinrt\MainPage.idl">
<DependentUpon>$(SharedContentDir)\xaml\MainPage.xaml</DependentUpon>
</Midl>
<Midl Include="Project.idl" />
</ItemGroup>
<ItemGroup>
<AppxManifest Include="Package.appxmanifest">
<SubType>Designer</SubType>
</AppxManifest>
</ItemGroup>
<ItemGroup>
<Image Include="$(SharedContentDir)\media\microsoft-sdk.png">
<Link>Assets\microsoft-sdk.png</Link>
</Image>
<Image Include="$(SharedContentDir)\media\smalltile-sdk.png">
<Link>Assets\smallTile-sdk.png</Link>
</Image>
<Image Include="$(SharedContentDir)\media\splash-sdk.png">
<Link>Assets\splash-sdk.png</Link>
</Image>
<Image Include="$(SharedContentDir)\media\squaretile-sdk.png">
<Link>Assets\squareTile-sdk.png</Link>
</Image>
<Image Include="$(SharedContentDir)\media\storelogo-sdk.png">
<Link>Assets\storeLogo-sdk.png</Link>
</Image>
<Image Include="$(SharedContentDir)\media\tile-sdk.png">
<Link>Assets\tile-sdk.png</Link>
</Image>
<Image Include="$(SharedContentDir)\media\windows-sdk.png">
<Link>Assets\windows-sdk.png</Link>
</Image>
<Image Include="..\shared\Assets\appDataLocal.png">
<Link>Assets\appDataLocal.png</Link>
</Image>
<Image Include="..\shared\Assets\appDataRoaming.png">
<Link>Assets\appDataRoaming.png</Link>
</Image>
<Image Include="..\shared\Assets\appDataTemp.png">
<Link>Assets\appDataTemp.png</Link>
</Image>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="packages\Microsoft.Windows.CppWinRT.2.0.210629.4\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('packages\Microsoft.Windows.CppWinRT.2.0.210629.4\build\native\Microsoft.Windows.CppWinRT.targets')" />
</ImportGroup>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('packages\Microsoft.Windows.CppWinRT.2.0.210629.4\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Microsoft.Windows.CppWinRT.2.0.210629.4\build\native\Microsoft.Windows.CppWinRT.props'))" />
<Error Condition="!Exists('packages\Microsoft.Windows.CppWinRT.2.0.210629.4\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Microsoft.Windows.CppWinRT.2.0.210629.4\build\native\Microsoft.Windows.CppWinRT.targets'))" />
</Target>
</Project>
Loading

0 comments on commit 589f33b

Please sign in to comment.