diff --git a/Directory.Build.Override.props b/Directory.Build.Override.props index 3ec3a76eb25b..8115232d291d 100644 --- a/Directory.Build.Override.props +++ b/Directory.Build.Override.props @@ -7,7 +7,7 @@ <_IncludeWindows> <_IncludeTizen> <_IncludeGtk>true - <_IncludeAndroid>true + <_IncludeAndroid>false <_IncludeIos> <_IncludeMacCatalyst> <_IncludeMacOS> diff --git a/Directory.Build.props b/Directory.Build.props index 7abf80742891..24c2612b10d4 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -148,7 +148,7 @@ <_MauiBuildTasksLocation Condition="'$(_MauiBuildTasksLocation)' == ''">$(MSBuildThisFileDirectory).buildtasks\ <_MauiAOTProfileLocation>$(MauiSrcDirectory)Controls\src\Build.Tasks\nuget\buildTransitive\netstandard2.0\ $(MauiRootDirectory)eng/microsoft.maui.controls.snk - true + false portable true true diff --git a/Microsoft.Maui.Gtk.slnf b/Microsoft.Maui.Gtk.slnf index a45a8f95510c..cad95068ccad 100644 --- a/Microsoft.Maui.Gtk.slnf +++ b/Microsoft.Maui.Gtk.slnf @@ -8,11 +8,14 @@ "src\\BlazorWebView\\src\\Gtk\\Microsoft.AspNetCore.Components.WebView.Gtk.csproj", "src\\BlazorWebView\\src\\Maui\\Microsoft.AspNetCore.Components.WebView.Maui.csproj", "src\\Compatibility\\Core\\src\\Compatibility.csproj", + "src\\Controls\\Foldable\\src\\Controls.Foldable.csproj", + "src\\Controls\\Maps\\src\\Controls.Maps.csproj", "src\\Controls\\samples\\Controls.Sample.Gtk\\Controls.Sample.Gtk.csproj", "src\\Controls\\samples\\Controls.Sample\\Maui.Controls.Sample.csproj", "src\\Controls\\src\\Build.Tasks\\Controls.Build.Tasks.csproj", "src\\Controls\\src\\Core\\Controls.Core.csproj", "src\\Controls\\src\\Xaml\\Controls.Xaml.csproj", + "src\\Core\\maps\\src\\Maps.csproj", "src\\Core\\src\\Core.csproj", "src\\Essentials\\src\\Essentials.csproj", "src\\Graphics\\samples\\GraphicsTester.Gtk\\GraphicsTester.Gtk.csproj", diff --git a/NuGet.config b/NuGet.config index 7c8de06d63f3..5b1b0a2a5de3 100644 --- a/NuGet.config +++ b/NuGet.config @@ -6,6 +6,7 @@ + diff --git a/eng/Versions.props b/eng/Versions.props index f39295b01c56..9b809845e7e1 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -50,7 +50,7 @@ 8.0.0 8.0.0 - 8.0.0 + 9.0.0 3.3.4 3.3.4 4.5.0 diff --git a/src/BlazorWebView/src/Maui/Microsoft.AspNetCore.Components.WebView.Maui.csproj b/src/BlazorWebView/src/Maui/Microsoft.AspNetCore.Components.WebView.Maui.csproj index 533fa5eee4a4..df1a37e1179b 100644 --- a/src/BlazorWebView/src/Maui/Microsoft.AspNetCore.Components.WebView.Maui.csproj +++ b/src/BlazorWebView/src/Maui/Microsoft.AspNetCore.Components.WebView.Maui.csproj @@ -1,7 +1,7 @@  - $(_MauiDotNetTfm);$(MauiPlatforms) + $(_MauiDotNetTfm) enable $(DefineConstants);WEBVIEW2_MAUI true diff --git a/src/Controls/samples/Controls.Sample.Gtk/Properties/launchSettings.json b/src/Controls/samples/Controls.Sample.Gtk/Properties/launchSettings.json new file mode 100644 index 000000000000..322b624761c8 --- /dev/null +++ b/src/Controls/samples/Controls.Sample.Gtk/Properties/launchSettings.json @@ -0,0 +1,11 @@ +{ + "profiles": { + "Controls.Sample.Gtk": { + "commandName": "Project" + }, + "WSL": { + "commandName": "WSL2", + "distributionName": "" + } + } +} \ No newline at end of file diff --git a/src/Controls/samples/Controls.Sample/Maui.Controls.Sample.csproj b/src/Controls/samples/Controls.Sample/Maui.Controls.Sample.csproj index ff72f827a19f..2d9c0d669d3c 100644 --- a/src/Controls/samples/Controls.Sample/Maui.Controls.Sample.csproj +++ b/src/Controls/samples/Controls.Sample/Maui.Controls.Sample.csproj @@ -39,24 +39,24 @@ - - + + - - - + + + - + diff --git a/src/Controls/samples/Controls.Sample/Properties/launchSettings.json b/src/Controls/samples/Controls.Sample/Properties/launchSettings.json index af97d49d1598..30f0afacb90c 100644 --- a/src/Controls/samples/Controls.Sample/Properties/launchSettings.json +++ b/src/Controls/samples/Controls.Sample/Properties/launchSettings.json @@ -3,6 +3,14 @@ "Windows Machine": { "commandName": "MsixPackage", "nativeDebugging": true + }, + "WSL": { + "commandName": "WSL2", + "distributionName": "", + "environmentVariables": { + "DISPLAY": "127.0.0.1:0.0", + "DOTNET_ENVIRONMENT": "Development" + } } } } \ No newline at end of file diff --git a/src/Core/src/Core.csproj b/src/Core/src/Core.csproj index 275496ee8471..df9eed1e3f28 100644 --- a/src/Core/src/Core.csproj +++ b/src/Core/src/Core.csproj @@ -26,6 +26,7 @@ + @@ -75,32 +76,14 @@ - + <_ValuesToReplace Include="VERSION" PropertyName="PackageReferenceVersion" /> - - + + - + diff --git a/src/Core/src/ImageSources/FileImageSourceService/FileImageSourceService.Gtk.cs b/src/Core/src/ImageSources/FileImageSourceService/FileImageSourceService.Gtk.cs index c54e5252ad05..4ca5b7d38685 100644 --- a/src/Core/src/ImageSources/FileImageSourceService/FileImageSourceService.Gtk.cs +++ b/src/Core/src/ImageSources/FileImageSourceService/FileImageSourceService.Gtk.cs @@ -3,9 +3,11 @@ using System.ComponentModel.DataAnnotations; using System.IO; using System.Linq; +using System.Text.RegularExpressions; using System.Threading; using System.Threading.Tasks; using Microsoft.Extensions.Logging; +using Microsoft.Maui.Storage; using NativeImage = Gdk.Pixbuf; namespace Microsoft.Maui @@ -23,40 +25,71 @@ public partial class FileImageSourceService return FromResult(null); var filename = imageSource.File; + var pureFilename = Path.GetFileNameWithoutExtension(imageSource.File); + var ext = Path.GetExtension(imageSource.File); - NativeImage? TryLoadFile(string file) + int scaleInt = (int)Math.Round(scale * 100); + string scaledFilename = $"{pureFilename}.scale-{scaleInt}{ext}"; + + var rgxMatchScaling = new Regex(@"scale-(\d+)"); + + NativeImage? TryLoadFile() { - if (File.Exists(file)) + if (File.Exists(filename)) return new NativeImage(filename); + if (File.Exists(scaledFilename)) + return new(scaledFilename); + + var files = Directory.GetFiles(AppContext.BaseDirectory, "*"+ext).Select(x => Path.GetFileName(x)).ToArray(); + files = files.Where(x => x.StartsWith(pureFilename) && rgxMatchScaling.IsMatch(x)).ToArray(); + + if (files.Length == 0) return null; + + var scaling = files.Where(x => rgxMatchScaling.IsMatch(x)).ToDictionary(x => int.Parse(rgxMatchScaling.Match(x).Groups[1].Value), y => y); + var closestScale = scaling.Keys.OrderBy(s => Math.Abs(s - scaleInt)).FirstOrDefault(); + var res = scaling[closestScale]; + + if (res != null) return new(Path.Combine(AppContext.BaseDirectory, res)); + return null; } - NativeImage? TryLoadResource(string file) + NativeImage? TryLoadEmbededMauiImage() { + var baseName = $"MauiGTK.MauiImages.{pureFilename}"; + foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies()) { var names = assembly.GetManifestResourceNames(); - var res = names.FirstOrDefault(r => r.EndsWith($".{file}")); + names = names.Where(x => x.Contains(baseName, StringComparison.InvariantCulture) && x.EndsWith(ext)).ToArray(); + + if (names.Length == 0) continue; + + var scaledFullqualifiedName = names.FirstOrDefault(x => x.Contains(scaledFilename, StringComparison.InvariantCulture)); - if (res != null) + if (scaledFullqualifiedName != null) { - return new(assembly, res); + return new(assembly, scaledFullqualifiedName); } + + var scaling = names.Where(x => rgxMatchScaling.IsMatch(x)).ToDictionary(x => int.Parse(rgxMatchScaling.Match(x).Groups[1].Value), y => y); + var closestScale = scaling.Keys.OrderBy(s => Math.Abs(s - scaleInt)).FirstOrDefault(); + var res = scaling[closestScale]; + + if (res != null) return new(assembly, res); } return default; - } try { - var image = TryLoadFile(filename); + var image = TryLoadFile(); if (image == null) { - image = TryLoadResource(filename); - + image = TryLoadEmbededMauiImage(); } if (image == null) @@ -77,6 +110,7 @@ public partial class FileImageSourceService static Task?> FromResult(IImageSourceServiceResult? result) => Task.FromResult(result); + } } \ No newline at end of file diff --git a/src/Essentials/src/Essentials.csproj b/src/Essentials/src/Essentials.csproj index d04dc47706b1..c53843b9118b 100644 --- a/src/Essentials/src/Essentials.csproj +++ b/src/Essentials/src/Essentials.csproj @@ -70,6 +70,10 @@ + + + +