Skip to content

Commit 1aaa8a8

Browse files
committed
Merge branch 'main' into user/niels9001/more-options
2 parents e07ce65 + 5c5dd57 commit 1aaa8a8

16 files changed

+456
-145
lines changed

CommunityToolkit.Labs.Shared/Pages/Shell.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license. See the LICENSE file in the project root for more information. -->
1+
<!-- Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license. See the LICENSE file in the project root for more information. -->
22
<Page x:Class="CommunityToolkit.Labs.Shared.Pages.Shell"
33
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
44
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

CommunityToolkit.Labs.Shared/Renderers/ToolkitSampleRenderer.xaml

Lines changed: 154 additions & 107 deletions
Large diffs are not rendered by default.

CommunityToolkit.Labs.Shared/Renderers/ToolkitSampleRenderer.xaml.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,13 +156,12 @@ private async Task LoadData()
156156
CSharpCode = await GetMetadataFileContents(Metadata, "xaml.cs");
157157

158158
var sampleControlInstance = (UIElement)Metadata.SampleControlFactory();
159-
159+
160160
// Custom control-based sample options.
161161
if (Metadata.SampleOptionsPaneType is not null && Metadata.SampleOptionsPaneFactory is not null)
162162
{
163163
SampleOptionsPaneInstance = (UIElement)Metadata.SampleOptionsPaneFactory(sampleControlInstance);
164164
}
165-
166165
// Source generater-based sample options
167166
else if (sampleControlInstance is IToolkitSampleGeneratedOptionPropertyContainer propertyContainer)
168167
{
@@ -175,6 +174,10 @@ private async Task LoadData()
175174
SampleOptions = propertyContainer.GeneratedPropertyMetadata
176175
};
177176
}
177+
else
178+
{
179+
OptionsScrollViewer.Visibility = Visibility.Collapsed;
180+
}
178181

179182
// Generated options must be assigned before attempting to render the control,
180183
// else some platforms will nullref from XAML but not properly ignore the exception when binding to generated properties.

CommunityToolkit.Labs.Shared/Styles/Buttons.xaml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -348,9 +348,5 @@
348348
<!--<Setter Property="Foreground" Value="{ThemeResource TextFillColorSecondaryBrush}" />-->
349349
</Style>
350350

351-
<Style x:Key="SmallAppBarButtonStyle"
352-
BasedOn="{StaticResource DefaultAppBarButtonStyle}"
353-
TargetType="AppBarButton">
354-
<Setter Property="Width" Value="36" />
355-
</Style>
351+
356352
</ResourceDictionary>

GenerateVSCodeLaunchConfig.ps1

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
Param (
2+
[Parameter(HelpMessage = "Disables suppressing changes to the ./.vscode/launch.json file in git, allowing changes to be committed.")]
3+
[switch]$allowGitChanges = $false
4+
)
5+
6+
function CreateVsCodeLaunchConfigJson {
7+
param (
8+
[string]$projectName
9+
)
10+
11+
return "{
12+
`"name`": `"$projectName`",
13+
`"type`": `"coreclr`",
14+
`"request`": `"launch`",
15+
`"program`": `"dotnet`",
16+
`"args`": [
17+
`"run`",
18+
`"build`",
19+
`"/r`",
20+
`"/p:UnoSourceGeneratorUseGenerationHost=true`",
21+
`"/p:UnoSourceGeneratorUseGenerationController=false`",
22+
`"/p:UnoRemoteControlPort=443`",
23+
`"--project=`$`{workspaceFolder`}/labs/$projectName/samples/$projectName.Wasm/$projectName.Wasm.csproj`"
24+
],
25+
`"presentation`": {
26+
`"group`": `"2`"
27+
},
28+
`"cwd`": `"`$`{workspaceFolder`}/labs/$projectName/samples/$projectName.Wasm`"
29+
}";
30+
}
31+
32+
$launchConfigJson = Get-Content -Path "$PSScriptRoot/../.vscode/launch.json" -ErrorAction Stop;
33+
$launchConfig = $launchConfigJson | ConvertFrom-Json;
34+
35+
# Remove all non-generated configurations
36+
$originalConfigurations = $launchConfig.configurations;
37+
$launchConfig.configurations = @();
38+
$launchConfig.configurations += $originalConfigurations[0];
39+
$launchConfig.configurations += $originalConfigurations[1];
40+
41+
foreach ($wasmProjectPath in Get-ChildItem -Recurse -Path "$PSScriptRoot/../*/*/samples/*.Wasm/*.Wasm.csproj") {
42+
$projectName = [System.IO.Path]::GetFileNameWithoutExtension($wasmProjectPath) -Replace ".Wasm", "";
43+
Write-Host "Generating VSCode launch config for $projectName";
44+
45+
$configJson = CreateVsCodeLaunchConfigJson $projectName;
46+
$config = $configJson | ConvertFrom-Json;
47+
48+
$launchConfig.configurations += $config;
49+
}
50+
51+
if ($allowGitChanges.IsPresent) {
52+
Write-Warning "Changes to the default launch.json can now be committed. Run this command again without the -allowGitChanges flag to disable committing further changes.";
53+
git update-index --no-assume-unchanged $PSScriptRoot/../.vscode/launch.json
54+
}
55+
else {
56+
Write-Output "Changes to the default launch.json are now suppressed. To switch branches, run git reset --hard with a clean working tree. Include the -allowGitChanges flag to enable committing changes.";
57+
git update-index --assume-unchanged $PSScriptRoot/../.vscode/launch.json
58+
}
59+
60+
# Save
61+
Set-Content -Path "$PSScriptRoot/../.vscode/launch.json" -Value ($launchConfig | ConvertTo-Json -Depth 9);
62+
Write-Output "Saved VSCode launch configs to $(Resolve-Path $PSScriptRoot/../.vscode/launch.json)";

Labs.Head.WinAppSdk.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
</PropertyGroup>
1919

2020
<ItemGroup>
21-
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.0.3" />
22-
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22000.194" />
21+
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.2.221209.1" />
22+
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22621.755" />
2323
<Manifest Include="$(ApplicationManifest)" />
2424
</ItemGroup>
2525

Labs.Head.props

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
<IsAllExperimentHead Condition="$(MSBuildProjectName.StartsWith('CommunityToolkit.Labs.')) == 'true'">true</IsAllExperimentHead>
3030
<IsProjectTemplateHead Condition="$(MSBuildProjectName.StartsWith('ProjectTemplate')) == 'true'">true</IsProjectTemplateHead>
3131
<IsSingleExperimentHead Condition="'$(IsAllExperimentHead)' != 'true' AND '$(IsProjectTemplateHead)' != 'true'">true</IsSingleExperimentHead>
32+
33+
<DefineConstants Condition="$(IsAllExperimentHead) == 'true'">$(DefineConstants);LABS_ALL_SAMPLES</DefineConstants>
3234
</PropertyGroup>
3335

3436
<!-- See https://github.com/CommunityToolkit/Labs-Windows/issues/142 -->

Labs.SampleRefs.props.template

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

MultiTarget/Defaults.props

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<Project>
2+
<PropertyGroup>
3+
<MultiTarget>uwp;wasdk;wpf;wasm;linuxgtk;macos;ios;android;</MultiTarget>
4+
</PropertyGroup>
5+
</Project>
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
Param (
2+
[Parameter(HelpMessage = "The directory where props files for discovered projects should be saved.")]
3+
[string]$projectPropsOutputDir = "$PSScriptRoot/Generated"
4+
)
5+
6+
$preWorkingDir = $pwd;
7+
Set-Location $PSScriptRoot;
8+
9+
# Delete and recreate output folder.
10+
Remove-Item -Path $projectPropsOutputDir -Recurse -Force -ErrorAction SilentlyContinue | Out-Null;
11+
New-Item -ItemType Directory -Force -Path $projectPropsOutputDir -ErrorAction SilentlyContinue | Out-Null;
12+
13+
# Discover projects in provided paths
14+
foreach ($projectPath in Get-ChildItem -Directory -Depth 0 -Path "$PSScriptRoot/../../labs/") {
15+
# Normalize project path
16+
$projectName = $projectPath.Name;
17+
18+
# Folder layout is expected to match the Community Toolkit.
19+
# Uses the <MultiTarget> values from the source library project as the fallback for the sample project.
20+
# This behavior also implemented in MultiTarget.props for TargetFramework evaluation.
21+
$srcPath = Resolve-Path "$($projectPath.FullName)\src";
22+
$srcProjectPath = Get-ChildItem -File "$srcPath\*.csproj";
23+
24+
$samplePath = Resolve-Path "$($projectPath.FullName)\samples\$projectName.Samples";
25+
$sampleProjectPath = Get-ChildItem -File "$samplePath\*.csproj";
26+
27+
if ($srcProjectPath.Length -eq 0) {
28+
Write-Error "Could not locate source csproj for $projectName";
29+
exit(-1);
30+
}
31+
32+
if ($sampleProjectPath.Length -eq 0) {
33+
Write-Error "Could not locate sample csproj for $projectName";
34+
exit(-1);
35+
}
36+
37+
# Generate <ProjectReference>s for sample project
38+
# Use source project MultiTarget as first fallback.
39+
& $PSScriptRoot\GenerateMultiTargetAwareProjectReferenceProps.ps1 -projectPath $sampleProjectPath -outputPath "$projectPropsOutputDir/$($sampleProjectPath.BaseName).props" -multiTargetFallbackPropsPath @("$srcPath/MultiTarget.props", "$samplePath/MultiTarget.props", "$PSScriptRoot/Defaults.props");
40+
41+
# Generate <ProjectReference>s for src project
42+
& $PSScriptRoot\GenerateMultiTargetAwareProjectReferenceProps.ps1 -projectPath $srcProjectPath -outputPath "$projectPropsOutputDir/$($srcProjectPath.BaseName).props" -multiTargetFallbackPropsPath @("$srcPath/MultiTarget.props", "$PSScriptRoot/Defaults.props");
43+
}
44+
45+
46+
Set-Location $preWorkingDir;

0 commit comments

Comments
 (0)