Skip to content

Commit

Permalink
.NET 9 samples (#521)
Browse files Browse the repository at this point in the history
* Initial check-in.

* Remove readme's so that 8.0 samples rule in the samples browser.

* Bump logging package to 9-rc1.

* Bump to .NET 9.

* Bump Apple platforms min version.

* Remove compat NuGet package ref.

* Update CI

* .NET 9 compliance.

* Fix builds.

* Cherry pick updates from 8.0 folder.

* TitleBar demo for Windows.

* Add readme.

* Cherry pick of #525

* Cherry pick of #519

* Set WindowsPackageType to None.

* Set commandName to Project.

* Fix code.

* Replace dotnet_bot image.

* Update Logging package to RC2.

* Move readme's to 9.0 folder.

* Fix samples on Windows.

* Fix supported versions.

* Set RID.

* Handlers disconnect automatically.

* Make app unpackaged.

* Replace obsoleted MainPage property.

* Fix samples.

* Don't set IPhoneResourcePrefix.

* Bump extensions to GA release.

* Fix remaining .NET 8 refs.

---------

Co-authored-by: Gerald Versluis <gerald.versluis@microsoft.com>
  • Loading branch information
davidbritch and jfversluis authored Nov 13, 2024
1 parent a3dd342 commit 22cba8b
Show file tree
Hide file tree
Showing 4,257 changed files with 157,065 additions and 180 deletions.
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)
{
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

0 comments on commit 22cba8b

Please sign in to comment.