Skip to content

Commit c048a1d

Browse files
committed
Merge branch 'main' into winui
2 parents 78697ba + e8029ec commit c048a1d

File tree

77 files changed

+764
-579
lines changed

Some content is hidden

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

77 files changed

+764
-579
lines changed

CommunityToolkit.Common/CommunityToolkit.Common.csproj

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@
1414
<PackageTags>Windows;Community;Toolkit;WCT;UWP;Incremental;Loading;Collection;IncrementalLoadingCollection;String;Array;extensions;helpers</PackageTags>
1515
</PropertyGroup>
1616

17-
<!-- .NET Standard 1.4 doesn't have the [Pure] attribute -->
18-
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.4' ">
19-
<PackageReference Include="System.Diagnostics.Contracts" Version="4.3.0" />
20-
</ItemGroup>
21-
2217
<!-- .NET Standard 2.1 and .NET 5 already have [NotNullIfNotNull] and [NotNullWhen] -->
23-
<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard2.1' OR '$(TargetFramework)' == 'net5.0' ">
18+
<PropertyGroup Condition="'$(TargetFramework)' == 'netstandard2.1' OR '$(TargetFramework)' == 'net5.0'">
2419
<DefineConstants>NETSTANDARD2_1_OR_GREATER</DefineConstants>
2520
</PropertyGroup>
2621

22+
<!-- .NET Standard 1.4 doesn't have the [Pure] attribute -->
23+
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard1.4'">
24+
<PackageReference Include="System.Diagnostics.Contracts" Version="4.3.0" />
25+
</ItemGroup>
26+
2727
</Project>

CommunityToolkit.Diagnostics/CommunityToolkit.Diagnostics.csproj

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,34 +13,35 @@
1313
</Description>
1414
<PackageTags>Windows;Community;Toolkit;WCT;UWP;Incremental;Loading;Collection;IncrementalLoadingCollection;String;Array;extensions;helpers</PackageTags>
1515
</PropertyGroup>
16+
1617
<Choose>
17-
<When Condition=" '$(TargetFramework)' == 'netstandard1.4' ">
18+
<When Condition="'$(TargetFramework)' == 'netstandard1.4'">
19+
<!-- .NET Standard 1.4 doesn't have the Span<T> type, ValueTuple or the [Pure] attribute -->
1820
<ItemGroup>
19-
20-
<!-- .NET Standard 1.4 doesn't have the Span<T> type, ValueTuple or the [Pure] attribute -->
2121
<PackageReference Include="System.Diagnostics.Contracts" Version="4.3.0" />
2222
<PackageReference Include="System.ValueTuple" Version="4.5.0" />
2323
<PackageReference Include="System.Memory" Version="4.5.4" />
2424
</ItemGroup>
2525
</When>
26-
<When Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
27-
<ItemGroup>
2826

29-
<!-- .NET Standard 2.0 doesn't have the Span<T> type -->
27+
<When Condition="'$(TargetFramework)' == 'netstandard2.0'">
28+
<!-- .NET Standard 2.0 doesn't have the Span<T> type -->
29+
<ItemGroup>
3030
<PackageReference Include="System.Memory" Version="4.5.4" />
3131
</ItemGroup>
3232
</When>
33-
<When Condition=" '$(TargetFramework)' == 'netstandard2.1' ">
33+
34+
<When Condition="'$(TargetFramework)' == 'netstandard2.1'">
3435
<PropertyGroup>
3536
<DefineConstants>NETSTANDARD2_1_OR_GREATER</DefineConstants>
3637
</PropertyGroup>
38+
<!-- .NET Standard 2.1 doesn't have the Unsafe type -->
3739
<ItemGroup>
38-
39-
<!-- .NET Standard 2.1 doesn't have the Unsafe type -->
4040
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="5.0.0" />
4141
</ItemGroup>
4242
</When>
43-
<When Condition=" '$(TargetFramework)' == 'net5.0' ">
43+
44+
<When Condition="'$(TargetFramework)' == 'net5.0'">
4445
<PropertyGroup>
4546
<DefineConstants>NETSTANDARD2_1_OR_GREATER</DefineConstants>
4647
</PropertyGroup>

CommunityToolkit.HighPerformance/CommunityToolkit.HighPerformance.csproj

Lines changed: 50 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,19 @@
2424
</Description>
2525
<PackageTags>Windows;Community;Toolkit;WCT;UWP;core;standard;unsafe;span;memory;string;array;stream;buffer;extensions;helpers;parallel;performance</PackageTags>
2626
</PropertyGroup>
27+
2728
<Choose>
28-
<When Condition=" '$(TargetFramework)' == 'netstandard1.4' ">
29+
<When Condition="'$(TargetFramework)' == 'netstandard1.4'">
30+
<!--
31+
.NET Standard 1.4 lacks the [Pure] attribute, the Rectangle primitive,
32+
the Span<T> and Memory<T> types, the Vector<T> primitive and related APIs,
33+
ValueTask and ValueTask<T>, the Parallel class and the Unsafe class.
34+
We also need to reference the System.Runtime.CompilerServices.Unsafe package directly,
35+
even though System.Memory references it already, as we need a more recent version than
36+
the one bundled with it. This is so that we can use the Unsafe.Unbox<T> method,
37+
which is used by the Box<T> type in the package.
38+
-->
2939
<ItemGroup>
30-
31-
<!-- .NET Standard 1.4 lacks the [Pure] attribute, the Rectangle primitive,
32-
the Span<T> and Memory<T> types, the Vector<T> primitive and related APIs,
33-
ValueTask and ValueTask<T>, the Parallel class and the Unsafe class.
34-
We also need to reference the System.Runtime.CompilerServices.Unsafe package directly,
35-
even though System.Memory references it already, as we need a more recent version than
36-
the one bundled with it. This is so that we can use the Unsafe.Unbox<T> method,
37-
which is used by the Box<T> type in the package. -->
3840
<PackageReference Include="System.Diagnostics.Contracts" Version="4.3.0" />
3941
<PackageReference Include="System.Drawing.Primitives" Version="4.3.0" />
4042
<PackageReference Include="System.Memory" Version="4.5.4" />
@@ -44,65 +46,70 @@
4446
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="5.0.0" />
4547
</ItemGroup>
4648
</When>
47-
<When Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
48-
<ItemGroup>
4949

50-
<!-- .NET Standard 2.0 doesn't have the Span<T>, HashCode and ValueTask types -->
50+
<When Condition="'$(TargetFramework)' == 'netstandard2.0'">
51+
<!-- .NET Standard 2.0 doesn't have the Span<T>, HashCode and ValueTask types -->
52+
<ItemGroup>
5153
<PackageReference Include="Microsoft.Bcl.HashCode" Version="1.1.0" />
5254
<PackageReference Include="System.Memory" Version="4.5.4" />
5355
<PackageReference Include="System.Threading.Tasks.Extensions" Version="4.5.4" />
5456
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="5.0.0" />
5557
</ItemGroup>
5658
</When>
57-
<When Condition=" '$(TargetFramework)' == 'netstandard2.1' ">
58-
<ItemGroup>
5959

60-
<!-- .NET Standard 2.1 doesn't have the Unsafe type -->
61-
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="5.0.0" />
62-
</ItemGroup>
63-
<PropertyGroup>
64-
65-
<!-- NETSTANDARD2_1_OR_GREATER: includes both .NET Standard 2.1 and .NET Core 3.1.
66-
This is needed because .NET Core 3.1 will be a separate package than .NET Standard 2.1. -->
60+
<When Condition="'$(TargetFramework)' == 'netstandard2.1'">
61+
<!--
62+
NETSTANDARD2_1_OR_GREATER: includes both .NET Standard 2.1 and .NET Core 3.1.
63+
This is needed because .NET Core 3.1 will be a separate package than .NET Standard 2.1.
6764
68-
<!-- SPAN_RUNTIME_SUPPORT: define a constant to indicate runtimes with runtime support for
69-
the fast Span<T> type, as well as some overloads with Span<T> parameters (eg. Stream.Write).
70-
In particular, these are runtimes which are able to create Span<T> instances from just
71-
a managed reference, which can be used to slice arbitrary objects not technically supported.
72-
This API (MemoryMarshal.CreateSpan) is not part of .NET Standard 2.0, but it is still
73-
available on .NET Core 2.1. So by using this constant, we can make sure to expose those
74-
APIs relying on that method on all target frameworks that are able to support them. -->
75-
<DefineConstants>NETSTANDARD2_1_OR_GREATER;SPAN_RUNTIME_SUPPORT</DefineConstants>
76-
</PropertyGroup>
77-
</When>
78-
<When Condition=" '$(TargetFramework)' == 'net5.0' ">
65+
SPAN_RUNTIME_SUPPORT: define a constant to indicate runtimes with runtime support for
66+
the fast Span<T> type, as well as some overloads with Span<T> parameters (eg. Stream.Write).
67+
In particular, these are runtimes which are able to create Span<T> instances from just
68+
a managed reference, which can be used to slice arbitrary objects not technically supported.
69+
This API (MemoryMarshal.CreateSpan) is not part of .NET Standard 2.0, but it is still
70+
available on .NET Core 2.1. So by using this constant, we can make sure to expose those
71+
APIs relying on that method on all target frameworks that are able to support them.
72+
-->
7973
<PropertyGroup>
8074
<DefineConstants>NETSTANDARD2_1_OR_GREATER;SPAN_RUNTIME_SUPPORT</DefineConstants>
8175
</PropertyGroup>
82-
</When>
83-
<When Condition=" '$(TargetFramework)' == 'netcoreapp3.1' ">
76+
<!-- .NET Standard 2.1 doesn't have the Unsafe type -->
8477
<ItemGroup>
8578
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="5.0.0" />
8679
</ItemGroup>
80+
</When>
81+
82+
<When Condition="'$(TargetFramework)' == 'net5.0'">
8783
<PropertyGroup>
84+
<DefineConstants>NETSTANDARD2_1_OR_GREATER;SPAN_RUNTIME_SUPPORT</DefineConstants>
85+
</PropertyGroup>
86+
</When>
8887

89-
<!-- NETCORE_RUNTIME: to avoid issues with APIs that assume a specific memory layout, we define a
90-
.NET Core runtime constant to indicate either .NET Core 2.1 or .NET Core 3.1. These are
91-
runtimes with the same overall memory layout for objects (in particular: strings, SZ arrays,
92-
and ND arrays). We can use this constant to make sure that APIs that are exclusively available
93-
for .NET Standard targets do not make any assumtpion of any internals of the runtime being
94-
actually used by the consumers. .NET 5.0 would fall into this category as well, but we don't
95-
need to include that target as it offers APIs that don't require runtime-based workarounds.-->
88+
<When Condition="'$(TargetFramework)' == 'netcoreapp3.1'">
89+
<!--
90+
NETCORE_RUNTIME: to avoid issues with APIs that assume a specific memory layout, we define a
91+
.NET Core runtime constant to indicate either .NET Core 2.1 or .NET Core 3.1. These are
92+
runtimes with the same overall memory layout for objects (in particular: strings, SZ arrays,
93+
and ND arrays). We can use this constant to make sure that APIs that are exclusively available
94+
for .NET Standard targets do not make any assumtpion of any internals of the runtime being
95+
actually used by the consumers. .NET 5.0 would fall into this category as well, but we don't
96+
need to include that target as it offers APIs that don't require runtime-based workarounds.
97+
-->
98+
<PropertyGroup>
9699
<DefineConstants>NETSTANDARD2_1_OR_GREATER;SPAN_RUNTIME_SUPPORT;NETCORE_RUNTIME</DefineConstants>
97100
</PropertyGroup>
98-
</When>
99-
<When Condition=" '$(TargetFramework)' == 'netcoreapp2.1' ">
100101
<ItemGroup>
101102
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="5.0.0" />
102103
</ItemGroup>
104+
</When>
105+
106+
<When Condition="'$(TargetFramework)' == 'netcoreapp2.1'">
103107
<PropertyGroup>
104108
<DefineConstants>SPAN_RUNTIME_SUPPORT;NETCORE_RUNTIME</DefineConstants>
105109
</PropertyGroup>
110+
<ItemGroup>
111+
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="5.0.0" />
112+
</ItemGroup>
106113
</When>
107114
</Choose>
108115

CommunityToolkit.Mvvm/CommunityToolkit.Mvvm.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@
2121
</PropertyGroup>
2222

2323
<!-- .NET Standard 2.0 doesn't have the Span<T> and IAsyncEnumerable<T> types -->
24-
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
24+
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
2525
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="5.0.0" />
2626
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
2727
<PackageReference Include="System.Memory" Version="4.5.4" />
2828
</ItemGroup>
2929

3030
<!-- .NET Standard 2.1 doesn't have the Unsafe type -->
31-
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.1' ">
31+
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.1'">
3232
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
3333
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="5.0.0" />
3434
</ItemGroup>

CommunityToolkit.Win32.WpfCore.SampleApp.PackagingProject/CommunityToolkit.Win32.WpfCore.SampleApp.PackagingProject.wapproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,4 +76,6 @@
7676
</ProjectReference>
7777
</ItemGroup>
7878
<Import Project="$(WapProjPath)\Microsoft.DesktopBridge.targets" />
79+
<!-- No-op to avoid build error when packing solution from commandline -->
80+
<Target Name="Pack" />
7981
</Project>

CommunityToolkit.WinUI.Connectivity/CommunityToolkit.WinUI.Connectivity.csproj

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@
88
</PropertyGroup>
99

1010
<ItemGroup>
11-
1211
<ProjectReference Include="..\CommunityToolkit.WinUI\CommunityToolkit.WinUI.csproj" />
13-
1412
</ItemGroup>
1513

1614
</Project>

CommunityToolkit.WinUI.Connectivity/Properties/CommunityToolkit.WinUI.Connectivity.rd.xml

Lines changed: 0 additions & 32 deletions
This file was deleted.

CommunityToolkit.WinUI.DeveloperTools/CommunityToolkit.WinUI.DeveloperTools.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
44
<TargetFrameworks>net5.0-windows10.0.18362.0</TargetFrameworks>

CommunityToolkit.WinUI.DeveloperTools/Properties/CommunityToolkit.WinUI.DeveloperTools.rd.xml

Lines changed: 0 additions & 4 deletions
This file was deleted.

CommunityToolkit.WinUI.Notifications/Adaptive/AdaptiveProgressBar.cs

Lines changed: 14 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,19 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33
// See the LICENSE file in the project root for more information.
44

5+
#pragma warning disable SA1121 // UseBuiltInTypeAlias
6+
7+
using System;
8+
using CommunityToolkit.WinUI.Notifications.Adaptive.Elements;
9+
510
#if WINRT
611
using System.Collections.Generic;
12+
using BindableProgressBarValue = CommunityToolkit.WinUI.Notifications.AdaptiveProgressBarValue;
13+
using BindableString = System.String;
14+
#else
15+
using BindableProgressBarValue = CommunityToolkit.WinUI.Notifications.BindableProgressBarValue;
16+
using BindableString = CommunityToolkit.WinUI.Notifications.BindableString;
717
#endif
8-
using System;
9-
using CommunityToolkit.WinUI.Notifications.Adaptive.Elements;
1018

1119
namespace CommunityToolkit.WinUI.Notifications
1220
{
@@ -25,46 +33,22 @@ public sealed class AdaptiveProgressBar : IToastBindingGenericChild
2533
/// <summary>
2634
/// Gets or sets an optional title string. Supports data binding.
2735
/// </summary>
28-
public
29-
#if WINRT
30-
string
31-
#else
32-
BindableString
33-
#endif
34-
Title { get; set; }
36+
public BindableString Title { get; set; }
3537

3638
/// <summary>
3739
/// Gets or sets the value of the progress bar. Supports data binding. Defaults to 0.
3840
/// </summary>
39-
public
40-
#if WINRT
41-
AdaptiveProgressBarValue
42-
#else
43-
BindableProgressBarValue
44-
#endif
45-
Value { get; set; } = AdaptiveProgressBarValue.FromValue(0);
41+
public BindableProgressBarValue Value { get; set; } = AdaptiveProgressBarValue.FromValue(0);
4642

4743
/// <summary>
4844
/// Gets or sets an optional string to be displayed instead of the default percentage string. If this isn't provided, something like "70%" will be displayed.
4945
/// </summary>
50-
public
51-
#if WINRT
52-
string
53-
#else
54-
BindableString
55-
#endif
56-
ValueStringOverride { get; set; }
46+
public BindableString ValueStringOverride { get; set; }
5747

5848
/// <summary>
5949
/// Gets or sets a status string (Required), which is displayed underneath the progress bar. This string should reflect the status of the operation, like "Downloading..." or "Installing..."
6050
/// </summary>
61-
public
62-
#if WINRT
63-
string
64-
#else
65-
BindableString
66-
#endif
67-
Status { get; set; }
51+
public BindableString Status { get; set; }
6852

6953
internal Element_AdaptiveProgressBar ConvertToElement()
7054
{

0 commit comments

Comments
 (0)