Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.NET 9 samples #521

Merged
merged 38 commits into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
fb5fbca
Initial check-in.
davidbritch Oct 1, 2024
ab2ac68
Remove readme's so that 8.0 samples rule in the samples browser.
davidbritch Oct 1, 2024
c0b7b2a
Bump logging package to 9-rc1.
davidbritch Oct 1, 2024
4224b25
Bump to .NET 9.
davidbritch Oct 1, 2024
d228789
Bump Apple platforms min version.
davidbritch Oct 1, 2024
fbec9d8
Remove compat NuGet package ref.
davidbritch Oct 1, 2024
7adba57
Update CI
jfversluis Oct 1, 2024
19f2e00
Merge branch 'dabritch-net9' of https://github.com/dotnet/maui-sample…
jfversluis Oct 1, 2024
d5f6db8
.NET 9 compliance.
davidbritch Oct 2, 2024
e21ec56
Fix builds.
davidbritch Oct 2, 2024
96adca4
Merge branch 'main' into dabritch-net9
davidbritch Oct 2, 2024
3971689
Cherry pick updates from 8.0 folder.
davidbritch Oct 2, 2024
5e27cf1
Merge branch 'main' into dabritch-net9
davidbritch Oct 2, 2024
b5588a1
Merge branch 'main' into dabritch-net9
davidbritch Oct 2, 2024
4222a7e
TitleBar demo for Windows.
davidbritch Oct 11, 2024
fd3da04
Add readme.
davidbritch Oct 11, 2024
8b75b4f
Merge branch 'main' into dabritch-net9
davidbritch Oct 11, 2024
3ae2170
Cherry pick of #525
davidbritch Oct 11, 2024
353b25b
Cherry pick of #519
davidbritch Oct 11, 2024
5ef3f3f
Merge branch 'main' into dabritch-net9
davidbritch Oct 15, 2024
11f9e1c
Set WindowsPackageType to None.
davidbritch Oct 29, 2024
b6aad15
Set commandName to Project.
davidbritch Oct 29, 2024
760dff7
Fix code.
davidbritch Oct 29, 2024
791e8ed
Replace dotnet_bot image.
davidbritch Oct 30, 2024
b7a8656
Update Logging package to RC2.
davidbritch Oct 30, 2024
cc837d9
Move readme's to 9.0 folder.
davidbritch Oct 30, 2024
286e6f5
Fix samples on Windows.
davidbritch Oct 30, 2024
f5cbc3d
Merge branch 'dabritch-net9' of https://github.com/dotnet/maui-sample…
davidbritch Oct 30, 2024
dc6c6b4
Merge branch 'main' into dabritch-net9
davidbritch Oct 30, 2024
a115d14
Fix supported versions.
davidbritch Oct 30, 2024
e529b75
Set RID.
davidbritch Oct 31, 2024
f007446
Handlers disconnect automatically.
davidbritch Oct 31, 2024
e68a4cb
Make app unpackaged.
davidbritch Oct 31, 2024
66cad44
Replace obsoleted MainPage property.
davidbritch Nov 4, 2024
fedce09
Fix samples.
davidbritch Nov 4, 2024
8b4119c
Don't set IPhoneResourcePrefix.
davidbritch Nov 11, 2024
8f44f1c
Bump extensions to GA release.
davidbritch Nov 12, 2024
b28dca7
Fix remaining .NET 8 refs.
davidbritch Nov 13, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
5 changes: 2 additions & 3 deletions .github/workflows/build-all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,10 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

# Remove when .NET 8 is default on hosted runners
- name: Install .NET 8
- name: Install .NET 9
uses: actions/setup-dotnet@v4.0.1
with:
dotnet-version: 8.0
dotnet-version: 9.0

- name: Install .NET MAUI Workload
run: dotnet workload install maui
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/build-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,10 @@ jobs:
with:
fetch-depth: 2

# Remove when .NET 8 is default on hosted runners
- name: Install .NET 8
- name: Install .NET 9
uses: actions/setup-dotnet@v4.0.1
with:
dotnet-version: 8.0
dotnet-version: 9.0

- name: Install .NET MAUI Workload
run: dotnet workload install maui
Expand Down
37 changes: 0 additions & 37 deletions 8.0/PlatformIntegration/NativeEmbeddingDemo/README.md

This file was deleted.

22 changes: 0 additions & 22 deletions 8.0/XAML/MarkupExtensions/README.md

This file was deleted.

27 changes: 27 additions & 0 deletions 9.0/Animations/Animations.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.31611.283
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Animations", "Animations\Animations.csproj", "{2B988494-145A-43E9-A5C9-BD5B6BB8AC51}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{2B988494-145A-43E9-A5C9-BD5B6BB8AC51}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2B988494-145A-43E9-A5C9-BD5B6BB8AC51}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2B988494-145A-43E9-A5C9-BD5B6BB8AC51}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
{2B988494-145A-43E9-A5C9-BD5B6BB8AC51}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2B988494-145A-43E9-A5C9-BD5B6BB8AC51}.Release|Any CPU.Build.0 = Release|Any CPU
{2B988494-145A-43E9-A5C9-BD5B6BB8AC51}.Release|Any CPU.Deploy.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {61F7FB11-1E47-470C-91E2-47F8143E1572}
EndGlobalSection
EndGlobal
67 changes: 67 additions & 0 deletions 9.0/Animations/Animations/Animations.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net9.0-android;net9.0-ios;net9.0-maccatalyst</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net9.0-windows10.0.19041.0</TargetFrameworks>
<!-- Uncomment to also build the tizen app. You will need to install tizen by following this: https://github.com/Samsung/Tizen.NET -->
<!-- <TargetFrameworks>$(TargetFrameworks);net9.0-tizen</TargetFrameworks> -->

<!-- Note for MacCatalyst:
The default runtime is maccatalyst-x64, except in Release config, in which case the default is maccatalyst-x64;maccatalyst-arm64.
When specifying both architectures, use the plural <RuntimeIdentifiers> instead of the singular <RuntimeIdentifier>.
The Mac App Store will NOT accept apps with ONLY maccatalyst-arm64 indicated;
either BOTH runtimes must be indicated or ONLY macatalyst-x64. -->
<!-- For example: <RuntimeIdentifiers>maccatalyst-x64;maccatalyst-arm64</RuntimeIdentifiers> -->

<OutputType>Exe</OutputType>
<RootNamespace>Animations</RootNamespace>
<UseMaui>true</UseMaui>
<SingleProject>true</SingleProject>
<ImplicitUsings>enable</ImplicitUsings>

<!-- Display name -->
<ApplicationTitle>Animations</ApplicationTitle>

<!-- App Identifier -->
<ApplicationId>com.companyname.animations</ApplicationId>

<!-- Versions -->
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
<ApplicationVersion>1</ApplicationVersion>

<!-- To develop, package, and publish an app to the Microsoft Store, see: https://aka.ms/MauiTemplateUnpackaged -->
<WindowsPackageType>None</WindowsPackageType>

<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">15.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">15.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">21.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</SupportedOSPlatformVersion>
<TargetPlatformMinVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</TargetPlatformMinVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'tizen'">6.5</SupportedOSPlatformVersion>
</PropertyGroup>

<ItemGroup>
<!-- App Icon -->
<MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" Color="#512BD4" />

<!-- Splash Screen -->
<MauiSplashScreen Include="Resources\Splash\splash.svg" Color="#512BD4" BaseSize="128,128" />

<!-- Images -->
<MauiImage Include="Resources\Images\*" />
<MauiImage Update="Resources\Images\dotnet_bot.png" Resize="True" BaseSize="300,185" />

<!-- Custom Fonts -->
<MauiFont Include="Resources\Fonts\*" />

<!-- Raw Assets (also remove the "Resources\Raw" prefix) -->
<MauiAsset Include="Resources\Raw\**" LogicalName="%(RecursiveDir)%(Filename)%(Extension)" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="CommunityToolkit.Maui" Version="6.0.0" />
<PackageReference Include="Microsoft.Maui.Controls" Version="$(MauiVersion)" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="9.0.0" />
</ItemGroup>

</Project>
15 changes: 15 additions & 0 deletions 9.0/Animations/Animations/App.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version = "1.0" encoding = "UTF-8" ?>
<Application xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:Animations"
x:Class="Animations.App">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Resources/Styles/Colors.xaml" />
<ResourceDictionary Source="Resources/Styles/Icons.xaml" />
<ResourceDictionary Source="Resources/Styles/Styles.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>
14 changes: 14 additions & 0 deletions 9.0/Animations/Animations/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
namespace Animations;

public partial class App : Application
{
public App()
{
InitializeComponent();
}

protected override Window CreateWindow(IActivationState? activationState)

Check warning on line 10 in 9.0/Animations/Animations/App.xaml.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check warning on line 10 in 9.0/Animations/Animations/App.xaml.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.
{
return new Window(new AppShell());
}
}
34 changes: 34 additions & 0 deletions 9.0/Animations/Animations/AppShell.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Shell
x:Class="Animations.AppShell"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:Animations"
Shell.FlyoutBehavior="Flyout">

<ShellContent
Title="Custom Animations"
ContentTemplate="{DataTemplate local:CustomAnimationPage}"
Route="custom" />

<ShellContent
Title="Fade"
ContentTemplate="{DataTemplate local:FadePage}"
Route="fade" />

<ShellContent
Title="Rotate"
ContentTemplate="{DataTemplate local:RotatePage}"
Route="rotate" />

<ShellContent
Title="Scale"
ContentTemplate="{DataTemplate local:ScalePage}"
Route="scale" />

<ShellContent
Title="Translate"
ContentTemplate="{DataTemplate local:TranslatePage}"
Route="translate" />

</Shell>
11 changes: 11 additions & 0 deletions 9.0/Animations/Animations/AppShell.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
namespace Animations;

public partial class AppShell : Shell
{
public AppShell()
{
InitializeComponent();

Routing.RegisterRoute(nameof(EasingEditorPage), typeof(EasingEditorPage));
}
}
28 changes: 28 additions & 0 deletions 9.0/Animations/Animations/Extensions/AnimationExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
namespace Animations.Extensions;

public static class ViewExtensions
{
public static Task<bool> ColorTo(this VisualElement self, Color fromColor, Color toColor, Action<Color> callback, uint length = 250, Easing easing = null)
{
Func<double, Color> transform = (t) =>
Color.FromRgba(fromColor.Red + t * (toColor.Red - fromColor.Red),
fromColor.Green + t * (toColor.Green - fromColor.Green),
fromColor.Blue + t * (toColor.Blue - fromColor.Blue),
fromColor.Alpha + t * (toColor.Alpha - fromColor.Alpha));
return ColorAnimation(self, "ColorTo", transform, callback, length, easing);
}

public static void CancelAnimation(this VisualElement self)
{
self.AbortAnimation("ColorTo");
}

static Task<bool> ColorAnimation(VisualElement element, string name, Func<double, Color> transform, Action<Color> callback, uint length, Easing easing)
{
easing = easing ?? Easing.Linear;
var taskCompletionSource = new TaskCompletionSource<bool>();

element.Animate<Color>(name, transform, callback, 16, length, easing, (v, c) => taskCompletionSource.SetResult(c));
return taskCompletionSource.Task;
}
}
Loading
Loading