Skip to content

Commit 0db108e

Browse files
committed
Windows 11 Version 22H2 - May 2024 Samples Update
1 parent bd31b44 commit 0db108e

File tree

182 files changed

+1457
-15298
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

182 files changed

+1457
-15298
lines changed

README.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -450,16 +450,17 @@ For additional Windows samples, see [Windows on GitHub](http://microsoft.github.
450450
<tr>
451451
<td><a href="Samples/Personalization">Lock screen personalization</a></td>
452452
<td><a href="Samples/MicrosoftPassport">Microsoft Passport and Windows Hello</a></td>
453-
<td><a href="Samples/SmartCard">Smart cards</a></td>
453+
<td><a href="Samples/PersonalDataEncryption">Personal Data Encryption</a></td>
454454
</tr>
455455
<tr>
456+
<td><a href="Samples/SmartCard">Smart cards</a></td>
456457
<td><a href="Samples/UserInfo">User information</a></td>
457458
<td><a href="Samples/UserCertificateStore">UserCertificateStore</a></td>
458-
<td><a href="Samples/UserConsentVerifier">UserConsentVerifier</a></td>
459459
</tr>
460460
<tr>
461461
<td><a href="Samples/WebAccountManagement">Web account management</a></td>
462462
<td><a href="Samples/WebAuthenticationBroker">WebAuthenticationBroker</a></td>
463+
<td><a href="Samples/UserConsentVerifier">UserConsentVerifier</a></td>
463464
</tr>
464465
</table>
465466

Samples/Geolocation/README.md

+31-33
Original file line numberDiff line numberDiff line change
@@ -27,68 +27,66 @@ and track when the location changes in various ways.
2727

2828
After obtaining access to the user's location, an app can
2929

30-
* Retrieve the current location.
31-
* Receiving events when the location changes.
32-
* Receiving events when the device has entered or exited locations of interest.
33-
* Receiving events when the device has spent significant time in a location (a "visit").
30+
- Retrieve the current location.
31+
- Receiving events when the location changes.
32+
- Receiving events when the device has entered or exited locations of interest.
33+
- Receiving events when the device has spent significant time in a location (a "visit").
3434

35-
> **Note:** This sample is part of a large collection of UWP feature samples.
35+
> **Note:** This sample is part of a large collection of UWP feature samples.
3636
> You can download this sample as a standalone ZIP file
3737
> [from docs.microsoft.com](https://docs.microsoft.com/samples/microsoft/windows-universal-samples/geolocation/),
3838
> or you can download the entire collection as a single
39-
> [ZIP file](https://github.com/Microsoft/Windows-universal-samples/archive/master.zip), but be
40-
> sure to unzip everything to access shared dependencies. For more info on working with the ZIP file,
41-
> the samples collection, and GitHub, see [Get the UWP samples from GitHub](https://aka.ms/ovu2uq).
42-
> For more samples, see the [Samples portal](https://aka.ms/winsamples) on the Windows Dev Center.
39+
> [ZIP file](https://github.com/Microsoft/Windows-universal-samples/archive/master.zip), but be
40+
> sure to unzip everything to access shared dependencies. For more info on working with the ZIP file,
41+
> the samples collection, and GitHub, see [Get the UWP samples from GitHub](https://aka.ms/ovu2uq).
42+
> For more samples, see the [Samples portal](https://aka.ms/winsamples) on the Windows Dev Center.
4343
4444
This sample also shows how to:
4545

46-
- **Use a [geofence](http://msdn.microsoft.com/library/windows/apps/dn263744):** Receive notifications when the user's device has entered or left an area of interest.
47-
- **Handle changes in location permissions**: Register for the Geolocator's StatusChanged event and use the [StatusChangedEventArgs](http://msdn.microsoft.com/library/windows/apps/br225600) to determine the current position status.
48-
- **Get location from a background task**
49-
- **Handle geofencing events from a background task**
50-
- **Handle geovisit events from a background task**
51-
- **Obtain satellite data:** When available, use the [GeocoordinateSatelliteData](http://msdn.microsoft.com/library/windows/apps/jj635260) class to obtain additional information on the quality of the satellite based location data.
52-
- **Display a toast:** Notify the user when a geofencing event has occurred in the background.
53-
- **Refresh geofence binding:** Refresh the binding on resume and after removal of a geofence. Note that removal requires subscribing to removal events if a geofence is set as single use or a duration is set.
46+
- **Use a [geofence](http://msdn.microsoft.com/library/windows/apps/dn263744):** Receive notifications when the user's device has entered or left an area of interest.
47+
- **Handle changes in location permissions**: Register for the Geolocator's StatusChanged event and use the [StatusChangedEventArgs](http://msdn.microsoft.com/library/windows/apps/br225600) to determine the current position status.
48+
- **Get location from a background task**
49+
- **Handle geofencing events from a background task**
50+
- **Handle geovisit events from a background task**
51+
- **Obtain satellite data:** When available, use the [GeocoordinateSatelliteData](http://msdn.microsoft.com/library/windows/apps/jj635260) class to obtain additional information on the quality of the satellite based location data.
52+
- **Display a toast:** Notify the user when a geofencing event has occurred in the background.
53+
- **Refresh geofence binding:** Refresh the binding on resume and after removal of a geofence. Note that removal requires subscribing to removal events if a geofence is set as single use or a duration is set.
5454
- **Request access to the user's location:** Request access to the user's location using the RequestAccessAsync method. Important: call the RequestAccessAsync before accessing the user's location. At that time, your app must be in the foreground and RequestAccessAsync must be called from the UI thread. Until the user grants your app permission to their location, your app can't access location data.
55-
- **Track when the user visits a location:** Poll for or receive notifications when the user spends significant time in a location.
55+
- **Track when the user visits a location:** Poll for or receive notifications when the user spends significant time in a location.
5656
- **Help the user change location settings:** Link to location privacy settings from your app if the user revokes access to location while your app is in the foreground. Call the LaunchUriAsync method with the URI "ms-settings://privacy/location".
5757

58-
Geofences need to be created in the Foreground Geofencing scenario (Scenario 4) and then you can go to Background Geofencing scenario (Scenario 5) to register for background geofencing events.
58+
Geofences need to be created in the foreground geofencing scenario (Scenario 4) and then you can go to background geofencing scenario (Scenario 5) to register for background geofencing events.
5959

60-
The Geolocation sample formats and parses time and dates in the en-US locale using the Gregorian calendar and 24-hour clock. To help other locales in entering data the edit fields have a format example shown below the control. For example, Start Time would be entered mm/dd/yyyy hh:mm:ss format. February 2, 2014 at 10:34 pm would be written 2/2/2014 22:34:00. For the Dwell Time and Duration the format is dd:hh:mm:ss so a time span of 7 days, 23 hours, 45 minutes and 55 seconds would be written as 7:23:45:55.
60+
The Geolocation sample formats and parses time and dates in the en-US locale using the Gregorian calendar and 24-hour clock. To help other locales in entering data the edit fields have a format example shown below the control. For example, Start Time would be entered mm/dd/yyyy hh:mm:ss format. February 2, 2014 at 10:34 pm would be written 2/2/2014 22:34:00. For the Dwell Time and Duration the format is dd:hh:mm:ss so a time span of 7 days, 23 hours, 45 minutes and 55 seconds would be written as 7:23:45:55.
6161

62-
### Declaring the Location capability
62+
## Declaring the Location capability
6363

6464
This sample requires that location capability be set in the *Package.appxmanifest* file to allow the app to access location at runtime. The capability can be set in the app manifest using Microsoft Visual Studio.
6565

66-
6766
## Related topics
6867

6968
### Conceptual
7069

71-
* [Get current location](https://msdn.microsoft.com/library/windows/apps/mt219698)
72-
* [Guidelines for location-aware apps](https://msdn.microsoft.com/library/windows/apps/hh465148)
70+
- [Get current location](https://msdn.microsoft.com/library/windows/apps/mt219698)
71+
- [Guidelines for location-aware apps](https://msdn.microsoft.com/library/windows/apps/hh465148)
7372

7473
### Reference
7574

76-
* [Windows.Devices.Geolocation](http://msdn.microsoft.com/library/windows/apps/br225603)
77-
* [Windows.Devices.Geolocation.Geofencing](https://msdn.microsoft.com/library/windows/apps/dn263744)
75+
- [Windows.Devices.Geolocation](http://msdn.microsoft.com/library/windows/apps/br225603)
76+
- [Windows.Devices.Geolocation.Geofencing](https://msdn.microsoft.com/library/windows/apps/dn263744)
7877

7978
### Related samples
8079

81-
* [Traffic App sample](https://github.com/microsoft/windows-appsample-trafficapp/)
82-
* [Lunch Scheduler app sample](https://github.com/Microsoft/Windows-appsample-lunch-scheduler)
83-
* [Geolocation sample](/archived/Geolocation/) for C++/CX and JavaScript (archived)
80+
- [Traffic App sample](https://github.com/microsoft/windows-appsample-trafficapp/)
81+
- [Lunch Scheduler app sample](https://github.com/Microsoft/Windows-appsample-lunch-scheduler)
8482

8583
## System requirements
8684

87-
* Windows 10
85+
- Requires Windows SDK 10.0.22621.0 to build and Windows 10 to run.
8886

8987
## Build the sample
9088

91-
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.
89+
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.
9290
2. Start Microsoft Visual Studio and select **File** \> **Open** \> **Project/Solution**.
9391
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 Solution (.sln) file.
9492
4. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
@@ -99,8 +97,8 @@ The next steps depend on whether you just want to deploy the sample or you want
9997

10098
### Deploying the sample
10199

102-
- Select Build > Deploy Solution.
100+
- Select Build > Deploy Solution.
103101

104102
### Deploying and running the sample
105103

106-
- 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 selectDebug > Start Without Debugging.
104+
- 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 selectDebug > Start Without Debugging.

Samples/Geolocation/cppwinrt/Scenario1_TrackPosition.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include "pch.h"
1313
#include "Scenario1_TrackPosition.h"
1414
#include "Scenario1_TrackPosition.g.cpp"
15+
#include "SampleConfiguration.h"
1516

1617
using namespace winrt;
1718
using namespace winrt::Windows::Devices::Geolocation;
@@ -173,13 +174,15 @@ namespace winrt::SDKTemplate::implementation
173174
ScenarioOutput_Latitude().Text(L"No data");
174175
ScenarioOutput_Longitude().Text(L"No data");
175176
ScenarioOutput_Accuracy().Text(L"No data");
177+
ScenarioOutput_Source().Text(L"No data");
176178
ScenarioOutput_IsRemoteSource().Text(L"No data");
177179
}
178180
else
179181
{
180182
ScenarioOutput_Latitude().Text(to_hstring(position.Coordinate().Point().Position().Latitude));
181183
ScenarioOutput_Longitude().Text(to_hstring(position.Coordinate().Point().Position().Longitude));
182184
ScenarioOutput_Accuracy().Text(to_hstring(position.Coordinate().Accuracy()));
185+
ScenarioOutput_Source().Text(to_hstring(position.Coordinate().PositionSource()));
183186
ScenarioOutput_IsRemoteSource().Text(to_hstring(position.Coordinate().IsRemoteSource()));
184187
}
185188
}

Samples/Geolocation/cs/Geolocation.csproj

+29-9
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,30 @@
2121
<FileAlignment>512</FileAlignment>
2222
<ProjectTypeGuids>{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
2323
</PropertyGroup>
24+
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|ARM64'">
25+
<DebugSymbols>true</DebugSymbols>
26+
<OutputPath>bin\ARM64\Debug\</OutputPath>
27+
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UAP</DefineConstants>
28+
<NoWarn>;2008</NoWarn>
29+
<NoStdLib>true</NoStdLib>
30+
<DebugType>full</DebugType>
31+
<PlatformTarget>ARM64</PlatformTarget>
32+
<UseVSHostingProcess>false</UseVSHostingProcess>
33+
<LangVersion>7.3</LangVersion>
34+
<ErrorReport>prompt</ErrorReport>
35+
</PropertyGroup>
36+
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|ARM64'">
37+
<OutputPath>bin\ARM64\Release\</OutputPath>
38+
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UAP</DefineConstants>
39+
<Optimize>true</Optimize>
40+
<NoWarn>;2008</NoWarn>
41+
<NoStdLib>true</NoStdLib>
42+
<DebugType>pdbonly</DebugType>
43+
<PlatformTarget>ARM64</PlatformTarget>
44+
<UseVSHostingProcess>false</UseVSHostingProcess>
45+
<LangVersion>7.3</LangVersion>
46+
<ErrorReport>prompt</ErrorReport>
47+
</PropertyGroup>
2448
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|ARM'">
2549
<DebugSymbols>true</DebugSymbols>
2650
<OutputPath>bin\ARM\Debug\</OutputPath>
@@ -53,7 +77,6 @@
5377
<PlatformTarget>x64</PlatformTarget>
5478
<UseVSHostingProcess>false</UseVSHostingProcess>
5579
<ErrorReport>prompt</ErrorReport>
56-
<Prefer32Bit>true</Prefer32Bit>
5780
</PropertyGroup>
5881
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
5982
<OutputPath>bin\x64\Release\</OutputPath>
@@ -64,7 +87,6 @@
6487
<PlatformTarget>x64</PlatformTarget>
6588
<UseVSHostingProcess>false</UseVSHostingProcess>
6689
<ErrorReport>prompt</ErrorReport>
67-
<Prefer32Bit>true</Prefer32Bit>
6890
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
6991
</PropertyGroup>
7092
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
@@ -194,6 +216,9 @@
194216
<Content Include="$(SharedContentDir)\media\smalltile-sdk.png">
195217
<Link>Assets\smallTile-sdk.png</Link>
196218
</Content>
219+
<Content Include="$(SharedContentDir)\media\badge-logo.png">
220+
<Link>Assets\badge-logo.png</Link>
221+
</Content>
197222
<Content Include="$(SharedContentDir)\media\splash-sdk.png">
198223
<Link>Assets\splash-sdk.png</Link>
199224
</Content>
@@ -218,12 +243,7 @@
218243
</ItemGroup>
219244
<ItemGroup>
220245
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform">
221-
<Version>5.0.0</Version>
222-
</PackageReference>
223-
</ItemGroup>
224-
<ItemGroup>
225-
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform">
226-
<Version>5.0.0</Version>
246+
<Version>6.2.14</Version>
227247
</PackageReference>
228248
</ItemGroup>
229249
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '14.0' ">
@@ -237,4 +257,4 @@
237257
<Target Name="AfterBuild">
238258
</Target>
239259
-->
240-
</Project>
260+
</Project>

Samples/Geolocation/cs/Geolocation.sln

+12
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,21 @@ EndProject
1010
Global
1111
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1212
Debug|ARM = Debug|ARM
13+
Debug|ARM64 = Debug|ARM64
1314
Debug|x64 = Debug|x64
1415
Debug|x86 = Debug|x86
1516
Release|ARM = Release|ARM
17+
Release|ARM64 = Release|ARM64
1618
Release|x64 = Release|x64
1719
Release|x86 = Release|x86
1820
EndGlobalSection
1921
GlobalSection(ProjectConfigurationPlatforms) = postSolution
2022
{C214806D-57CA-5528-89FA-B9A7DEB22DFF}.Debug|ARM.ActiveCfg = Debug|ARM
2123
{C214806D-57CA-5528-89FA-B9A7DEB22DFF}.Debug|ARM.Build.0 = Debug|ARM
2224
{C214806D-57CA-5528-89FA-B9A7DEB22DFF}.Debug|ARM.Deploy.0 = Debug|ARM
25+
{C214806D-57CA-5528-89FA-B9A7DEB22DFF}.Debug|ARM64.ActiveCfg = Debug|ARM64
26+
{C214806D-57CA-5528-89FA-B9A7DEB22DFF}.Debug|ARM64.Build.0 = Debug|ARM64
27+
{C214806D-57CA-5528-89FA-B9A7DEB22DFF}.Debug|ARM64.Deploy.0 = Debug|ARM64
2328
{C214806D-57CA-5528-89FA-B9A7DEB22DFF}.Debug|x64.ActiveCfg = Debug|x64
2429
{C214806D-57CA-5528-89FA-B9A7DEB22DFF}.Debug|x64.Build.0 = Debug|x64
2530
{C214806D-57CA-5528-89FA-B9A7DEB22DFF}.Debug|x64.Deploy.0 = Debug|x64
@@ -29,6 +34,9 @@ Global
2934
{C214806D-57CA-5528-89FA-B9A7DEB22DFF}.Release|ARM.ActiveCfg = Release|ARM
3035
{C214806D-57CA-5528-89FA-B9A7DEB22DFF}.Release|ARM.Build.0 = Release|ARM
3136
{C214806D-57CA-5528-89FA-B9A7DEB22DFF}.Release|ARM.Deploy.0 = Release|ARM
37+
{C214806D-57CA-5528-89FA-B9A7DEB22DFF}.Release|ARM64.ActiveCfg = Release|ARM64
38+
{C214806D-57CA-5528-89FA-B9A7DEB22DFF}.Release|ARM64.Build.0 = Release|ARM64
39+
{C214806D-57CA-5528-89FA-B9A7DEB22DFF}.Release|ARM64.Deploy.0 = Release|ARM64
3240
{C214806D-57CA-5528-89FA-B9A7DEB22DFF}.Release|x64.ActiveCfg = Release|x64
3341
{C214806D-57CA-5528-89FA-B9A7DEB22DFF}.Release|x64.Build.0 = Release|x64
3442
{C214806D-57CA-5528-89FA-B9A7DEB22DFF}.Release|x64.Deploy.0 = Release|x64
@@ -37,12 +45,16 @@ Global
3745
{C214806D-57CA-5528-89FA-B9A7DEB22DFF}.Release|x86.Deploy.0 = Release|x86
3846
{5A7BDE18-030E-5DC9-B9A2-70EA568A6E9D}.Debug|ARM.ActiveCfg = Debug|ARM
3947
{5A7BDE18-030E-5DC9-B9A2-70EA568A6E9D}.Debug|ARM.Build.0 = Debug|ARM
48+
{5A7BDE18-030E-5DC9-B9A2-70EA568A6E9D}.Debug|ARM64.ActiveCfg = Debug|ARM64
49+
{5A7BDE18-030E-5DC9-B9A2-70EA568A6E9D}.Debug|ARM64.Build.0 = Debug|ARM64
4050
{5A7BDE18-030E-5DC9-B9A2-70EA568A6E9D}.Debug|x64.ActiveCfg = Debug|x64
4151
{5A7BDE18-030E-5DC9-B9A2-70EA568A6E9D}.Debug|x64.Build.0 = Debug|x64
4252
{5A7BDE18-030E-5DC9-B9A2-70EA568A6E9D}.Debug|x86.ActiveCfg = Debug|x86
4353
{5A7BDE18-030E-5DC9-B9A2-70EA568A6E9D}.Debug|x86.Build.0 = Debug|x86
4454
{5A7BDE18-030E-5DC9-B9A2-70EA568A6E9D}.Release|ARM.ActiveCfg = Release|ARM
4555
{5A7BDE18-030E-5DC9-B9A2-70EA568A6E9D}.Release|ARM.Build.0 = Release|ARM
56+
{5A7BDE18-030E-5DC9-B9A2-70EA568A6E9D}.Release|ARM64.ActiveCfg = Release|ARM64
57+
{5A7BDE18-030E-5DC9-B9A2-70EA568A6E9D}.Release|ARM64.Build.0 = Release|ARM64
4658
{5A7BDE18-030E-5DC9-B9A2-70EA568A6E9D}.Release|x64.ActiveCfg = Release|x64
4759
{5A7BDE18-030E-5DC9-B9A2-70EA568A6E9D}.Release|x64.Build.0 = Release|x64
4860
{5A7BDE18-030E-5DC9-B9A2-70EA568A6E9D}.Release|x86.ActiveCfg = Release|x86

Samples/Geolocation/cs/Package.appxmanifest

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<Application Id="App" Executable="$targetnametoken$.exe" EntryPoint="Geolocation.App">
1818
<uap:VisualElements DisplayName="Geolocation C# Sample" Square150x150Logo="Assets\SquareTile-sdk.png" Square44x44Logo="Assets\SmallTile-sdk.png" Description="Geolocation C# Sample" BackgroundColor="#00b2f0">
1919
<uap:SplashScreen Image="Assets\Splash-sdk.png" />
20-
<uap:LockScreen Notification="badge" BadgeLogo="Assets\smalltile-sdk.png" />
20+
<uap:LockScreen Notification="badge" BadgeLogo="Assets\badge-logo.png" />
2121
</uap:VisualElements>
2222
<Extensions>
2323
<Extension Category="windows.backgroundTasks" EntryPoint="BackgroundTask.GeofenceBackgroundTask">
@@ -41,4 +41,4 @@
4141
<Capabilities>
4242
<DeviceCapability Name="location" />
4343
</Capabilities>
44-
</Package>
44+
</Package>

Samples/Geolocation/cs/Scenario1_TrackPosition.xaml.cs

+2
Original file line numberDiff line numberDiff line change
@@ -197,13 +197,15 @@ private void UpdateLocationData(Geoposition position)
197197
ScenarioOutput_Latitude.Text = "No data";
198198
ScenarioOutput_Longitude.Text = "No data";
199199
ScenarioOutput_Accuracy.Text = "No data";
200+
ScenarioOutput_Source.Text = "No data";
200201
ScenarioOutput_IsRemoteSource.Text = "No data";
201202
}
202203
else
203204
{
204205
ScenarioOutput_Latitude.Text = position.Coordinate.Point.Position.Latitude.ToString();
205206
ScenarioOutput_Longitude.Text = position.Coordinate.Point.Position.Longitude.ToString();
206207
ScenarioOutput_Accuracy.Text = position.Coordinate.Accuracy.ToString();
208+
ScenarioOutput_Source.Text = position.Coordinate.PositionSource.ToString();
207209
ScenarioOutput_IsRemoteSource.Text = position.Coordinate.IsRemoteSource.ToString();
208210
}
209211
}

0 commit comments

Comments
 (0)