From b6e8de80fc6559c3d224dbe228b7604b416bb40f Mon Sep 17 00:00:00 2001 From: scoban Date: Fri, 21 Oct 2022 00:25:53 -0700 Subject: [PATCH 01/12] Update Package.appxmanifest to have PhonePublisherId (#9477) * Update Package.appxmanifest to have PhonePublisherId * Rename template variable to better represent what it is replacing * Revert version back to 0.0.0.0 as that is the default placeholder value * Update blazor template with phonepublisherid for publish scenarios --- .../src/templates/maui-blazor/.template.config/template.json | 5 +++++ .../maui-blazor/Platforms/Windows/Package.appxmanifest | 3 +++ .../src/templates/maui-mobile/.template.config/template.json | 5 +++++ .../maui-mobile/Platforms/Windows/Package.appxmanifest | 3 +++ 4 files changed, 16 insertions(+) diff --git a/src/Templates/src/templates/maui-blazor/.template.config/template.json b/src/Templates/src/templates/maui-blazor/.template.config/template.json index 473c8bd87220..6b4179f49f5a 100644 --- a/src/Templates/src/templates/maui-blazor/.template.config/template.json +++ b/src/Templates/src/templates/maui-blazor/.template.config/template.json @@ -75,6 +75,11 @@ "HostIdentifier": { "type": "bind", "binding": "HostIdentifier" + }, + "PhoneProductId": { + "type": "generated", + "generator": "guid", + "replaces": "$guid9$" } }, "defaultName": "MauiApp1" diff --git a/src/Templates/src/templates/maui-blazor/Platforms/Windows/Package.appxmanifest b/src/Templates/src/templates/maui-blazor/Platforms/Windows/Package.appxmanifest index 2bcb11edf7c6..ab686c3da0c7 100644 --- a/src/Templates/src/templates/maui-blazor/Platforms/Windows/Package.appxmanifest +++ b/src/Templates/src/templates/maui-blazor/Platforms/Windows/Package.appxmanifest @@ -2,11 +2,14 @@ + + $placeholder$ User Name diff --git a/src/Templates/src/templates/maui-mobile/.template.config/template.json b/src/Templates/src/templates/maui-mobile/.template.config/template.json index 668a95b7f336..24b6bd7178e1 100644 --- a/src/Templates/src/templates/maui-mobile/.template.config/template.json +++ b/src/Templates/src/templates/maui-mobile/.template.config/template.json @@ -79,6 +79,11 @@ "HostIdentifier": { "type": "bind", "binding": "HostIdentifier" + }, + "PhoneProductId": { + "type": "generated", + "generator": "guid", + "replaces": "$guid9$" } }, "defaultName": "MauiApp1" diff --git a/src/Templates/src/templates/maui-mobile/Platforms/Windows/Package.appxmanifest b/src/Templates/src/templates/maui-mobile/Platforms/Windows/Package.appxmanifest index 2bcb11edf7c6..ab686c3da0c7 100644 --- a/src/Templates/src/templates/maui-mobile/Platforms/Windows/Package.appxmanifest +++ b/src/Templates/src/templates/maui-mobile/Platforms/Windows/Package.appxmanifest @@ -2,11 +2,14 @@ + + $placeholder$ User Name From c429419ab50b7d36e8be5cad8de528cbc4888cae Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Mon, 24 Oct 2022 11:55:31 +0100 Subject: [PATCH 02/12] [net6.0] Update dependencies from xamarin/xamarin-macios (#10826) * Update dependencies from https://github.com/xamarin/xamarin-macios build 20221021.5 Microsoft.iOS.Sdk , Microsoft.MacCatalyst.Sdk , Microsoft.macOS.Sdk , Microsoft.tvOS.Sdk From Version 16.0.523 -> To Version 15.4.469 * Revert xcode14 versions Co-authored-by: dotnet-maestro[bot] Co-authored-by: Rui Marinho --- eng/Version.Details.xml | 8 ++++---- eng/Versions.props | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index b70b7009f9ee..ac1b080089f7 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -12,9 +12,9 @@ https://github.com/xamarin/xamarin-android 28f788ced6282094aaf18fab26b47f7d1e6e88cd - + https://github.com/xamarin/xamarin-macios - 23a6d4ad7354f535140eba662a81485eb010feb0 + 10eff25d69496f01de7a1c213463efce4f4d6387 https://github.com/xamarin/xamarin-macios @@ -24,9 +24,9 @@ https://github.com/xamarin/xamarin-macios 12aaa79efd7aefb65a3875e8c42da75e473077c6 - + https://github.com/xamarin/xamarin-macios - 23a6d4ad7354f535140eba662a81485eb010feb0 + 10eff25d69496f01de7a1c213463efce4f4d6387 https://github.com/dotnet/emsdk diff --git a/eng/Versions.props b/eng/Versions.props index 1213d6cbfcad..fd3a923e6594 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -12,8 +12,8 @@ 32.0.478 16.0.523 - 15.4.467 - 12.3.467 + 15.4.469 + 12.3.469 16.0.523 7.0.400-preview.1.0 From 7f28df4b94a15e4c79f4ceb6c69cc237168e26f8 Mon Sep 17 00:00:00 2001 From: Matthew Leibowitz Date: Mon, 24 Oct 2022 17:12:48 +0200 Subject: [PATCH 03/12] iOS 13+ devices do not allow status bar access (#10855) # Conflicts: # src/Essentials/src/PublicAPI/net-android/PublicAPI.Unshipped.txt # src/Essentials/src/PublicAPI/net-ios/PublicAPI.Unshipped.txt # src/Essentials/src/PublicAPI/net-maccatalyst/PublicAPI.Unshipped.txt # src/Essentials/src/PublicAPI/net-tizen/PublicAPI.Unshipped.txt # src/Essentials/src/PublicAPI/net-windows/PublicAPI.Unshipped.txt --- .../net-android/PublicAPI.Unshipped.txt | 4 + .../PublicAPI/net-ios/PublicAPI.Unshipped.txt | 4 + .../net-maccatalyst/PublicAPI.Unshipped.txt | 4 + .../net-tizen/PublicAPI.Unshipped.txt | 4 + .../net-windows/PublicAPI.Unshipped.txt | 4 + .../src/Screenshot/Screenshot.android.cs | 2 +- .../src/Screenshot/Screenshot.ios.cs | 115 +++------------- .../src/Screenshot/Screenshot.shared.cs | 20 +-- .../DeviceTests/Tests/Screenshot_Tests.cs | 130 +++++++++++++++--- 9 files changed, 157 insertions(+), 130 deletions(-) diff --git a/src/Essentials/src/PublicAPI/net-android/PublicAPI.Unshipped.txt b/src/Essentials/src/PublicAPI/net-android/PublicAPI.Unshipped.txt index ab058de62d44..ab29c60636ab 100644 --- a/src/Essentials/src/PublicAPI/net-android/PublicAPI.Unshipped.txt +++ b/src/Essentials/src/PublicAPI/net-android/PublicAPI.Unshipped.txt @@ -1 +1,5 @@ #nullable enable +*REMOVED*Microsoft.Maui.Media.IPlatformScreenshot.CaptureAsync(Android.Views.View! view) -> System.Threading.Tasks.Task! +Microsoft.Maui.Media.IPlatformScreenshot.CaptureAsync(Android.Views.View! view) -> System.Threading.Tasks.Task! +*REMOVED*static Microsoft.Maui.Media.ScreenshotExtensions.CaptureAsync(this Microsoft.Maui.Media.IScreenshot! screenshot, Android.Views.View! view) -> System.Threading.Tasks.Task! +static Microsoft.Maui.Media.ScreenshotExtensions.CaptureAsync(this Microsoft.Maui.Media.IScreenshot! screenshot, Android.Views.View! view) -> System.Threading.Tasks.Task! diff --git a/src/Essentials/src/PublicAPI/net-ios/PublicAPI.Unshipped.txt b/src/Essentials/src/PublicAPI/net-ios/PublicAPI.Unshipped.txt index ab058de62d44..9ec85f8e9ada 100644 --- a/src/Essentials/src/PublicAPI/net-ios/PublicAPI.Unshipped.txt +++ b/src/Essentials/src/PublicAPI/net-ios/PublicAPI.Unshipped.txt @@ -1 +1,5 @@ #nullable enable +*REMOVED*Microsoft.Maui.Media.IPlatformScreenshot.CaptureAsync(UIKit.UIView! view) -> System.Threading.Tasks.Task! +Microsoft.Maui.Media.IPlatformScreenshot.CaptureAsync(UIKit.UIView! view) -> System.Threading.Tasks.Task! +*REMOVED*static Microsoft.Maui.Media.ScreenshotExtensions.CaptureAsync(this Microsoft.Maui.Media.IScreenshot! screenshot, UIKit.UIView! view) -> System.Threading.Tasks.Task! +static Microsoft.Maui.Media.ScreenshotExtensions.CaptureAsync(this Microsoft.Maui.Media.IScreenshot! screenshot, UIKit.UIView! view) -> System.Threading.Tasks.Task! diff --git a/src/Essentials/src/PublicAPI/net-maccatalyst/PublicAPI.Unshipped.txt b/src/Essentials/src/PublicAPI/net-maccatalyst/PublicAPI.Unshipped.txt index ab058de62d44..9ec85f8e9ada 100644 --- a/src/Essentials/src/PublicAPI/net-maccatalyst/PublicAPI.Unshipped.txt +++ b/src/Essentials/src/PublicAPI/net-maccatalyst/PublicAPI.Unshipped.txt @@ -1 +1,5 @@ #nullable enable +*REMOVED*Microsoft.Maui.Media.IPlatformScreenshot.CaptureAsync(UIKit.UIView! view) -> System.Threading.Tasks.Task! +Microsoft.Maui.Media.IPlatformScreenshot.CaptureAsync(UIKit.UIView! view) -> System.Threading.Tasks.Task! +*REMOVED*static Microsoft.Maui.Media.ScreenshotExtensions.CaptureAsync(this Microsoft.Maui.Media.IScreenshot! screenshot, UIKit.UIView! view) -> System.Threading.Tasks.Task! +static Microsoft.Maui.Media.ScreenshotExtensions.CaptureAsync(this Microsoft.Maui.Media.IScreenshot! screenshot, UIKit.UIView! view) -> System.Threading.Tasks.Task! diff --git a/src/Essentials/src/PublicAPI/net-tizen/PublicAPI.Unshipped.txt b/src/Essentials/src/PublicAPI/net-tizen/PublicAPI.Unshipped.txt index ab058de62d44..256a238b54e2 100644 --- a/src/Essentials/src/PublicAPI/net-tizen/PublicAPI.Unshipped.txt +++ b/src/Essentials/src/PublicAPI/net-tizen/PublicAPI.Unshipped.txt @@ -1 +1,5 @@ #nullable enable +*REMOVED*Microsoft.Maui.Media.IPlatformScreenshot.CaptureAsync(Tizen.NUI.BaseComponents.View! view) -> System.Threading.Tasks.Task! +Microsoft.Maui.Media.IPlatformScreenshot.CaptureAsync(Tizen.NUI.BaseComponents.View! view) -> System.Threading.Tasks.Task! +*REMOVED*static Microsoft.Maui.Media.ScreenshotExtensions.CaptureAsync(this Microsoft.Maui.Media.IScreenshot! screenshot, Tizen.NUI.BaseComponents.View! view) -> System.Threading.Tasks.Task! +static Microsoft.Maui.Media.ScreenshotExtensions.CaptureAsync(this Microsoft.Maui.Media.IScreenshot! screenshot, Tizen.NUI.BaseComponents.View! view) -> System.Threading.Tasks.Task! diff --git a/src/Essentials/src/PublicAPI/net-windows/PublicAPI.Unshipped.txt b/src/Essentials/src/PublicAPI/net-windows/PublicAPI.Unshipped.txt index ab058de62d44..5712295502a0 100644 --- a/src/Essentials/src/PublicAPI/net-windows/PublicAPI.Unshipped.txt +++ b/src/Essentials/src/PublicAPI/net-windows/PublicAPI.Unshipped.txt @@ -1 +1,5 @@ #nullable enable +*REMOVED*Microsoft.Maui.Media.IPlatformScreenshot.CaptureAsync(Microsoft.UI.Xaml.UIElement! element) -> System.Threading.Tasks.Task! +Microsoft.Maui.Media.IPlatformScreenshot.CaptureAsync(Microsoft.UI.Xaml.UIElement! element) -> System.Threading.Tasks.Task! +*REMOVED*static Microsoft.Maui.Media.ScreenshotExtensions.CaptureAsync(this Microsoft.Maui.Media.IScreenshot! screenshot, Microsoft.UI.Xaml.UIElement! element) -> System.Threading.Tasks.Task! +static Microsoft.Maui.Media.ScreenshotExtensions.CaptureAsync(this Microsoft.Maui.Media.IScreenshot! screenshot, Microsoft.UI.Xaml.UIElement! element) -> System.Threading.Tasks.Task! diff --git a/src/Essentials/src/Screenshot/Screenshot.android.cs b/src/Essentials/src/Screenshot/Screenshot.android.cs index 7eb7ca83dbce..f07ca44834f3 100644 --- a/src/Essentials/src/Screenshot/Screenshot.android.cs +++ b/src/Essentials/src/Screenshot/Screenshot.android.cs @@ -44,7 +44,7 @@ public Task CaptureAsync(View view) _ = view ?? throw new ArgumentNullException(nameof(view)); var bitmap = Render(view); - var result = new ScreenshotResult(bitmap); + var result = bitmap is null ? null : new ScreenshotResult(bitmap); return Task.FromResult(result); } diff --git a/src/Essentials/src/Screenshot/Screenshot.ios.cs b/src/Essentials/src/Screenshot/Screenshot.ios.cs index cfbfe16218f9..f6bbaf7aebae 100644 --- a/src/Essentials/src/Screenshot/Screenshot.ios.cs +++ b/src/Essentials/src/Screenshot/Screenshot.ios.cs @@ -9,6 +9,7 @@ using CoreGraphics; using ObjCRuntime; using UIKit; +using Microsoft.Maui.ApplicationModel; namespace Microsoft.Maui.Media { @@ -17,26 +18,13 @@ partial class ScreenshotImplementation : IPlatformScreenshot, IScreenshot public bool IsCaptureSupported => true; - [System.Runtime.Versioning.SupportedOSPlatform("ios13.0")] - [System.Runtime.Versioning.SupportedOSPlatform("tvos13.0")] public Task CaptureAsync() { - var scenes = UIApplication.SharedApplication.ConnectedScenes; - //#pragma warning disable CA1416 // Known false positive with Lambda expression - var currentScene = scenes.ToArray().Where(n => n.ActivationState == UISceneActivationState.ForegroundActive).FirstOrDefault(); - //#pragma warning restore CA1416 - if (currentScene == null) - throw new InvalidOperationException("Unable to find current scene."); - - var uiWindowScene = currentScene as UIWindowScene; - if (uiWindowScene == null) - throw new InvalidOperationException("Unable to find current window scene."); - - var currentWindow = uiWindowScene.Windows.FirstOrDefault(n => n.IsKeyWindow); + var currentWindow = WindowStateManager.Default.GetCurrentUIWindow(); if (currentWindow == null) throw new InvalidOperationException("Unable to find current window."); - return CaptureAsync(currentWindow.Layer, true); + return CaptureAsync(currentWindow); } public Task CaptureAsync(UIWindow window) @@ -47,25 +35,10 @@ public Task CaptureAsync(UIWindow window) UIGraphics.BeginImageContextWithOptions(window.Bounds.Size, false, window.Screen.Scale); var ctx = UIGraphics.GetCurrentContext(); - if (!TryRender(window, out var error)) - { - // FIXME: test/handle this case - } - - // Render the status bar with the correct frame size - try - { - TryHideStatusClockView(UIApplication.SharedApplication); - var statusbarWindow = GetStatusBarWindow(UIApplication.SharedApplication); - if (statusbarWindow != null/* && metrics.StatusBar != null*/) - { - statusbarWindow.Frame = window.Frame; - statusbarWindow.Layer.RenderInContext(ctx); - } - } - catch + // ctx will be null if the width/height of the view is zero + if (ctx is not null && !TryRender(window, out _)) { - // FIXME: test/handle this case + // TODO: test/handle this case } var image = UIGraphics.GetImageFromCurrentImageContext(); @@ -76,7 +49,7 @@ public Task CaptureAsync(UIWindow window) return Task.FromResult(result); } - public Task CaptureAsync(UIView view) + public Task CaptureAsync(UIView view) { _ = view ?? throw new ArgumentNullException(nameof(view)); @@ -85,23 +58,20 @@ public Task CaptureAsync(UIView view) var ctx = UIGraphics.GetCurrentContext(); // ctx will be null if the width/height of the view is zero - if (ctx != null) + if (ctx is not null && !TryRender(view, out _)) { - if (!TryRender(view, out var error)) - { - // FIXME: test/handle this case - } + // TODO: test/handle this case } var image = UIGraphics.GetImageFromCurrentImageContext(); UIGraphics.EndImageContext(); - var result = new ScreenshotResult(image); + var result = image is null ? null : new ScreenshotResult(image); - return Task.FromResult(result); + return Task.FromResult(result); } - public Task CaptureAsync(CALayer layer, bool skipChildren) + public Task CaptureAsync(CALayer layer, bool skipChildren) { _ = layer ?? throw new ArgumentNullException(nameof(layer)); @@ -110,20 +80,17 @@ public Task CaptureAsync(CALayer layer, bool skipChildren) var ctx = UIGraphics.GetCurrentContext(); // ctx will be null if the width/height of the view is zero - if (ctx != null) + if (ctx is not null && !TryRender(layer, ctx, skipChildren, out _)) { - if (!TryRender(layer, ctx, skipChildren, out var error)) - { - // FIXME: test/handle this case - } + // TODO: test/handle this case } var image = UIGraphics.GetImageFromCurrentImageContext(); UIGraphics.EndImageContext(); - var result = new ScreenshotResult(image); + var result = image is null ? null : new ScreenshotResult(image); - return Task.FromResult(result); + return Task.FromResult(result); } static bool TryRender(UIView view, out Exception? error) @@ -192,56 +159,6 @@ static void RestoreSublayers(CALayer layer, Dictionary visibility sublayer.Key.Hidden = sublayer.Value; } } - - static void TryHideStatusClockView(UIApplication app) - { - var statusBarWindow = GetStatusBarWindow(app); - if (statusBarWindow == null) - return; - - var clockView = GetClockView(statusBarWindow); - if (clockView != null) - clockView.Hidden = true; - } - - static UIView? GetClockView(UIWindow window) - { - var classNames = new[] { - "UIStatusBar", - "UIStatusBarForegroundView", - "UIStatusBarTimeItemView" - }; - - return FindSubview(window, ((IEnumerable)classNames).GetEnumerator()); - - static UIView? FindSubview(UIView view, IEnumerator classNames) - { - if (!classNames.MoveNext()) - return view; - - foreach (var subview in view.Subviews) - { - if (subview.ToString().StartsWith($"<{classNames.Current}:", StringComparison.Ordinal)) - return FindSubview(subview, classNames); - } - - return null; - } - } - - static UIWindow? GetStatusBarWindow(UIApplication app) - { - if (!app.RespondsToSelector(statusBarWindowSelector)) - return null; - - var ptr = IntPtr_objc_msgSend(app.Handle, statusBarWindowSelector.Handle); - return ptr != IntPtr.Zero ? Runtime.GetNSObject(ptr) as UIWindow : null; - } - - static readonly Selector statusBarWindowSelector = new Selector("statusBarWindow"); - - [DllImport(Constants.ObjectiveCLibrary, EntryPoint = "objc_msgSend")] - static extern IntPtr IntPtr_objc_msgSend(IntPtr receiver, IntPtr selector); } partial class ScreenshotResult diff --git a/src/Essentials/src/Screenshot/Screenshot.shared.cs b/src/Essentials/src/Screenshot/Screenshot.shared.cs index 99ae3207029f..4f3e944f4db4 100644 --- a/src/Essentials/src/Screenshot/Screenshot.shared.cs +++ b/src/Essentials/src/Screenshot/Screenshot.shared.cs @@ -17,17 +17,17 @@ public interface IPlatformScreenshot : IScreenshot { #if ANDROID Task CaptureAsync(Android.App.Activity activity); - Task CaptureAsync(Android.Views.View view); + Task CaptureAsync(Android.Views.View view); #elif IOS || MACCATALYST Task CaptureAsync(UIKit.UIWindow window); - Task CaptureAsync(UIKit.UIView view); - //Task CaptureAsync(CoreAnimation.CALayer layer, bool skipChildren); + Task CaptureAsync(UIKit.UIView view); + //Task CaptureAsync(CoreAnimation.CALayer layer, bool skipChildren); #elif WINDOWS Task CaptureAsync(UI.Xaml.Window window); - Task CaptureAsync(UI.Xaml.UIElement element); + Task CaptureAsync(UI.Xaml.UIElement element); #elif TIZEN Task CaptureAsync(Tizen.NUI.Window window); - Task CaptureAsync(Tizen.NUI.BaseComponents.View view); + Task CaptureAsync(Tizen.NUI.BaseComponents.View view); #endif } @@ -89,7 +89,7 @@ static IPlatformScreenshot AsPlatform(this IScreenshot screenshot) public static Task CaptureAsync(this IScreenshot screenshot, Android.App.Activity activity) => screenshot.AsPlatform().CaptureAsync(activity); - public static Task CaptureAsync(this IScreenshot screenshot, Android.Views.View view) => + public static Task CaptureAsync(this IScreenshot screenshot, Android.Views.View view) => screenshot.AsPlatform().CaptureAsync(view); #elif IOS || MACCATALYST @@ -97,10 +97,10 @@ public static Task CaptureAsync(this IScreenshot screenshot, public static Task CaptureAsync(this IScreenshot screenshot, UIKit.UIWindow window) => screenshot.AsPlatform().CaptureAsync(window); - public static Task CaptureAsync(this IScreenshot screenshot, UIKit.UIView view) => + public static Task CaptureAsync(this IScreenshot screenshot, UIKit.UIView view) => screenshot.AsPlatform().CaptureAsync(view); - //public static Task CaptureAsync(this IScreenshot screenshot, CoreAnimation.CALayer layer, bool skipChildren) => + //public static Task CaptureAsync(this IScreenshot screenshot, CoreAnimation.CALayer layer, bool skipChildren) => // screenshot.AsPlatform().CaptureAsync(layer, skipChildren); #elif WINDOWS @@ -108,7 +108,7 @@ public static Task CaptureAsync(this IScreenshot screenshot, public static Task CaptureAsync(this IScreenshot screenshot, UI.Xaml.Window window) => screenshot.AsPlatform().CaptureAsync(window); - public static Task CaptureAsync(this IScreenshot screenshot, UI.Xaml.UIElement element) => + public static Task CaptureAsync(this IScreenshot screenshot, UI.Xaml.UIElement element) => screenshot.AsPlatform().CaptureAsync(element); #elif TIZEN @@ -116,7 +116,7 @@ public static Task CaptureAsync(this IScreenshot screenshot, public static Task CaptureAsync(this IScreenshot screenshot, Tizen.NUI.Window window) => screenshot.AsPlatform().CaptureAsync(window); - public static Task CaptureAsync(this IScreenshot screenshot, Tizen.NUI.BaseComponents.View view) => + public static Task CaptureAsync(this IScreenshot screenshot, Tizen.NUI.BaseComponents.View view) => screenshot.AsPlatform().CaptureAsync(view); #endif diff --git a/src/Essentials/test/DeviceTests/Tests/Screenshot_Tests.cs b/src/Essentials/test/DeviceTests/Tests/Screenshot_Tests.cs index f47c8ffab732..81ceed4dfa7c 100644 --- a/src/Essentials/test/DeviceTests/Tests/Screenshot_Tests.cs +++ b/src/Essentials/test/DeviceTests/Tests/Screenshot_Tests.cs @@ -1,6 +1,7 @@ using System; using System.IO; using System.Threading.Tasks; +using Microsoft.Maui.ApplicationModel; using Microsoft.Maui.Media; using Microsoft.Maui.Platform; using Xunit; @@ -15,13 +16,12 @@ public Task GetPngScreenshot() { return Utils.OnMainThread(async () => { - if (CanExecuteTest()) - { - await Task.Delay(100); - IScreenshotResult mediaFile = await Screenshot.CaptureAsync(); - var png = await mediaFile.OpenReadAsync(ScreenshotFormat.Png); - Assert.True(png.Length > 0); - } + await Task.Delay(100); + + IScreenshotResult mediaFile = await Screenshot.CaptureAsync(); + var png = await mediaFile.OpenReadAsync(ScreenshotFormat.Png); + + Assert.True(png.Length > 0); }); } @@ -30,23 +30,113 @@ public Task GetJpegScreenshot() { return Utils.OnMainThread(async () => { - if (CanExecuteTest()) - { - await Task.Delay(100); - IScreenshotResult mediaFile = await Screenshot.CaptureAsync(); - var png = await mediaFile.OpenReadAsync(ScreenshotFormat.Jpeg); - Assert.True(png.Length > 0); - } + await Task.Delay(100); + + IScreenshotResult mediaFile = await Screenshot.CaptureAsync(); + var png = await mediaFile.OpenReadAsync(ScreenshotFormat.Jpeg); + + Assert.True(png.Length > 0); }); } - static bool CanExecuteTest() + [Fact] + public Task CaptureStaticAsync() { -#if __IOS__ - return OperatingSystem.IsIOSVersionAtLeast(13) || OperatingSystem.IsTvOSVersionAtLeast(13); -#else - return true; -#endif + return Utils.OnMainThread(async () => + { + await Task.Delay(100); + + IScreenshotResult mediaFile = await Screenshot.CaptureAsync(); + + Assert.True(mediaFile.Width > 0); + Assert.True(mediaFile.Height > 0); + + using (var stream = await mediaFile.OpenReadAsync()) + Assert.True(stream.Length > 0); + }); + } + + [Fact] + public Task CaptureAsync() + { + return Utils.OnMainThread(async () => + { + await Task.Delay(100); + + IScreenshotResult mediaFile = await Screenshot.Default.CaptureAsync(); + + Assert.True(mediaFile.Width > 0); + Assert.True(mediaFile.Height > 0); + + using (var stream = await mediaFile.OpenReadAsync()) + Assert.True(stream.Length > 0); + }); + } + +#if IOS || MACCATALYST + + [Fact] + public Task CaptureWindowAsync() + { + return Utils.OnMainThread(async () => + { + await Task.Delay(100); + + var window = WindowStateManager.Default.GetCurrentUIWindow(); + + IScreenshotResult mediaFile = await Screenshot.Default.CaptureAsync(window); + + Assert.True(mediaFile.Width > 0); + Assert.True(mediaFile.Height > 0); + + using (var stream = await mediaFile.OpenReadAsync()) + Assert.True(stream.Length > 0); + }); + } + + [Fact] + public Task CaptureViewAsync() + { + return Utils.OnMainThread(async () => + { + await Task.Delay(100); + + var window = WindowStateManager.Default.GetCurrentUIWindow(); + var view = window.RootViewController.View; + + IScreenshotResult mediaFile = await Screenshot.Default.CaptureAsync(view); + + Assert.True(mediaFile.Width > 0); + Assert.True(mediaFile.Height > 0); + + using (var stream = await mediaFile.OpenReadAsync()) + Assert.True(stream.Length > 0); + }); } + + //[Theory] + //[InlineData(true)] + //[InlineData(false)] + //public Task CaptureLayerAsync(bool skipChildren) + //{ + // return Utils.OnMainThread(async () => + // { + // await Task.Delay(100); + + // var window = WindowStateManager.Default.GetCurrentUIWindow(); + // var view = window.RootViewController.View; + // var layer = view.Layer; + + // IScreenshotResult mediaFile = await Screenshot.Default.CaptureAsync(layer, skipChildren); + + // Assert.True(mediaFile.Width > 0); + // Assert.True(mediaFile.Height > 0); + + // using (var stream = await mediaFile.OpenReadAsync()) + // Assert.True(stream.Length > 0); + // }); + //} + +#endif } } From e0d29d2743f76cc7bb83a11709604d284c096da7 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Mon, 24 Oct 2022 18:17:26 +0100 Subject: [PATCH 04/12] Update dependencies from https://github.com/xamarin/xamarin-macios build 20221021.6 (#10869) Microsoft.iOS.Sdk , Microsoft.tvOS.Sdk From Version 16.0.523 -> To Version 16.0.525 Co-authored-by: dotnet-maestro[bot] --- eng/Version.Details.xml | 8 ++++---- eng/Versions.props | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index ac1b080089f7..9eb42b303d1d 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -16,13 +16,13 @@ https://github.com/xamarin/xamarin-macios 10eff25d69496f01de7a1c213463efce4f4d6387 - + https://github.com/xamarin/xamarin-macios - 12aaa79efd7aefb65a3875e8c42da75e473077c6 + dc7da0d737499409bed6be24c4a0f16683d7739e - + https://github.com/xamarin/xamarin-macios - 12aaa79efd7aefb65a3875e8c42da75e473077c6 + dc7da0d737499409bed6be24c4a0f16683d7739e https://github.com/xamarin/xamarin-macios diff --git a/eng/Versions.props b/eng/Versions.props index fd3a923e6594..7edfbee6dae3 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -11,10 +11,10 @@ 32.0.478 - 16.0.523 + 16.0.525 15.4.469 12.3.469 - 16.0.523 + 16.0.525 7.0.400-preview.1.0 From 90cd35e8b2bae4c0cfe8d81ace8746c60fa9b70f Mon Sep 17 00:00:00 2001 From: Gerald Versluis Date: Tue, 25 Oct 2022 12:11:05 +0200 Subject: [PATCH 05/12] Fix more inline API docs (#10785) * Update Animation.cs * Fixed Entry and related * Fix Button and related * Add bindable properties notes * - add loaded/unloaded docs * Apply suggestions from code review Co-authored-by: E.Z. Hart * Update src/Controls/src/Core/Animation.cs Co-authored-by: E.Z. Hart * Removed dead links Co-authored-by: Shane Neuville Co-authored-by: E.Z. Hart --- src/Controls/src/Core/ActionSheetArguments.cs | 3 +- src/Controls/src/Core/AlertArguments.cs | 3 +- src/Controls/src/Core/Animation.cs | 71 ++++-- src/Controls/src/Core/AnimationExtensions.cs | 3 - src/Controls/src/Core/Application.cs | 3 +- src/Controls/src/Core/AutomationProperties.cs | 3 - .../src/Core/BindableObjectExtensions.cs | 2 - .../src/Core/BindablePropertyConverter.cs | 6 +- src/Controls/src/Core/Binding.cs | 1 - src/Controls/src/Core/BrushTypeConverter.cs | 8 +- src/Controls/src/Core/Button.cs | 202 ++++++++++++++---- src/Controls/src/Core/ButtonElement.cs | 36 ++++ ...ColumnDefinitionCollectionTypeConverter.cs | 6 +- src/Controls/src/Core/Command.cs | 1 - src/Controls/src/Core/DatePicker.cs | 2 - src/Controls/src/Core/DecorableTextElement.cs | 4 - src/Controls/src/Core/DependencyService.cs | 6 - src/Controls/src/Core/DoubleCollection.cs | 1 - .../src/Core/DoubleCollectionConverter.cs | 6 +- src/Controls/src/Core/Editor.cs | 11 - src/Controls/src/Core/ElementTemplate.cs | 3 +- src/Controls/src/Core/Entry.cs | 152 +++++++++---- src/Controls/src/Core/EnumerableExtensions.cs | 5 +- .../src/Core/FileImageSourceConverter.cs | 6 +- src/Controls/src/Core/FontAttributes.cs | 6 +- src/Controls/src/Core/FontElement.cs | 12 ++ src/Controls/src/Core/FontImageSource.cs | 2 - src/Controls/src/Core/FontSizeConverter.cs | 6 +- src/Controls/src/Core/GestureRecognizer.cs | 3 +- .../src/Core/GridLengthTypeConverter.cs | 7 +- .../Core/HandlerImpl/Button/Button.Impl.cs | 1 - .../HandlerImpl/Button/Button.Standard.cs | 12 +- .../src/Core/HandlerImpl/Button/Button.cs | 11 +- .../HandlerImpl/CheckBox/CheckBox.Impl.cs | 5 +- .../Core/HandlerImpl/Element/Element.Impl.cs | 3 +- .../HandlerImpl/Element/Element.Standard.cs | 4 +- .../src/Core/HandlerImpl/Element/Element.cs | 3 +- .../src/Core/HandlerImpl/Ellipse.Impl.cs | 5 +- .../src/Core/HandlerImpl/Entry/Entry.Impl.cs | 1 - .../Core/HandlerImpl/FlyoutPage/FlyoutPage.cs | 3 +- .../Core/HandlerImpl/Label/Label.Standard.cs | 4 +- .../src/Core/HandlerImpl/Label/Label.cs | 3 +- .../src/Core/HandlerImpl/Line.Impl.cs | 5 +- .../src/Core/HandlerImpl/Page.Impl.cs | 3 +- .../src/Core/HandlerImpl/Path.Impl.cs | 3 +- .../src/Core/HandlerImpl/Polygon.Impl.cs | 5 +- .../src/Core/HandlerImpl/Polyline.Impl.cs | 5 +- .../HandlerImpl/RadioButton/RadioButton.cs | 3 +- .../src/Core/HandlerImpl/Rectangle.Impl.cs | 5 +- .../VisualElement/VisualElement.Impl.cs | 21 +- .../VisualElement/VisualElement.cs | 2 - src/Controls/src/Core/ImageSourceConverter.cs | 6 +- .../src/Core/Interactivity/TriggerAction.cs | 1 - src/Controls/src/Core/Internals/AsyncValue.cs | 3 +- .../src/Core/Internals/CellExtensions.cs | 5 - .../src/Core/Internals/ImageParser.cs | 4 - .../Core/Internals/TextTransformUtilites.cs | 21 +- .../Core/Items/CarouselLayoutTypeConverter.cs | 6 +- .../Core/Items/ItemsLayoutTypeConverter.cs | 6 +- src/Controls/src/Core/ItemsView.cs | 3 +- src/Controls/src/Core/Label.cs | 2 - .../src/Core/Layout/AbsoluteLayout.cs | 2 - .../src/Core/Layout/BoundsTypeConverter.cs | 6 +- src/Controls/src/Core/Layout/FlexLayout.cs | 12 -- src/Controls/src/Core/Layout/Grid.cs | 10 - src/Controls/src/Core/Layout/Layout.cs | 15 -- .../src/Core/LayoutOptionsConverter.cs | 9 +- .../src/Core/ListStringTypeConverter.cs | 6 +- src/Controls/src/Core/MessagingCenter.cs | 6 - src/Controls/src/Core/NameScopeExtensions.cs | 3 +- src/Controls/src/Core/NavigationModel.cs | 3 +- src/Controls/src/Core/Page.cs | 1 - src/Controls/src/Core/PanGestureRecognizer.cs | 3 +- src/Controls/src/Core/Picker.cs | 2 - .../src/Core/PlatformBindingHelpers.cs | 6 - .../WindowsSpecific/RefreshView.cs | 4 - .../WindowsSpecific/WebView.cs | 5 - src/Controls/src/Core/RadioButton.cs | 2 - src/Controls/src/Core/RadioButtonGroup.cs | 4 +- .../src/Core/ReferenceTypeConverter.cs | 6 +- src/Controls/src/Core/Registrar.cs | 14 -- src/Controls/src/Core/RouteFactory.cs | 1 - .../RowDefinitionCollectionTypeConverter.cs | 6 +- .../src/Core/ScrollToRequestedEventArgs.cs | 3 +- src/Controls/src/Core/SearchBar.cs | 8 - .../src/Core/Shapes/EllipseGeometry.cs | 3 +- src/Controls/src/Core/Shapes/Geometry.cs | 3 +- src/Controls/src/Core/Shapes/GeometryGroup.cs | 3 +- src/Controls/src/Core/Shapes/Line.cs | 1 - src/Controls/src/Core/Shapes/LineGeometry.cs | 3 +- .../src/Core/Shapes/MatrixTypeConverter.cs | 6 +- src/Controls/src/Core/Shapes/Path.cs | 1 - .../Shapes/PathFigureCollectionConverter.cs | 6 +- src/Controls/src/Core/Shapes/PathGeometry.cs | 3 +- .../src/Core/Shapes/PathGeometryConverter.cs | 6 +- .../Core/Shapes/PointCollectionConverter.cs | 6 +- src/Controls/src/Core/Shapes/Polygon.cs | 1 - src/Controls/src/Core/Shapes/Polyline.cs | 1 - .../src/Core/Shapes/RectangleGeometry.cs | 3 +- src/Controls/src/Core/Shapes/Shape.cs | 4 +- .../src/Core/Shapes/TransformTypeConverter.cs | 6 +- .../src/Core/Shell/BackButtonBehavior.cs | 4 +- src/Controls/src/Core/Shell/BaseShellItem.cs | 1 - src/Controls/src/Core/Shell/SearchHandler.cs | 6 +- src/Controls/src/Core/Shell/Shell.cs | 22 -- .../src/Core/Shell/ShellAppearance.cs | 6 +- src/Controls/src/Core/Span.cs | 2 - src/Controls/src/Core/TableSection.cs | 11 - src/Controls/src/Core/TextAlignment.cs | 7 +- src/Controls/src/Core/TextElement.cs | 9 + src/Controls/src/Core/TimePicker.cs | 2 - src/Controls/src/Core/TypeTypeConverter.cs | 6 +- src/Controls/src/Core/UriImageSource.cs | 4 +- src/Controls/src/Core/UriTypeConverter.cs | 4 - src/Controls/src/Core/VisualElement.cs | 9 +- .../src/Core/Visuals/VisualTypeConverter.cs | 9 +- .../src/Core/WebViewSourceTypeConverter.cs | 6 +- src/Core/src/Core/IButton.cs | 8 +- src/Core/src/Core/IEntry.cs | 2 +- src/Core/src/Platform/ViewExtensions.cs | 3 +- src/Core/src/Primitives/Aspect.cs | 3 +- .../src/Primitives/ClearButtonVisibility.cs | 14 +- src/Core/src/Primitives/Font.cs | 8 - src/Core/src/Primitives/LineBreakMode.cs | 34 ++- src/Core/src/Primitives/ReturnType.cs | 36 +++- src/Core/src/Primitives/TextTransform.cs | 23 +- src/Core/src/Primitives/Thickness.cs | 4 +- .../VisualDiagnostics/VisualDiagnostics.cs | 4 - .../VisualTreeChangeEventArgs.cs | 1 - src/Core/src/WeakEventManager.cs | 4 - .../src/AppActions/AppActions.shared.cs | 1 - src/Essentials/src/Compass/Compass.shared.cs | 1 - .../src/DeviceDisplay/DeviceDisplay.shared.cs | 3 +- .../src/Magnetometer/Magnetometer.shared.cs | 1 - .../src/Permissions/Permissions.shared.cs | 3 - .../src/Screenshot/Screenshot.shared.cs | 1 - .../src/SecureStorage/SecureStorage.shared.cs | 1 - src/Essentials/src/Types/Contact.shared.cs | 2 - .../WebAuthenticator.shared.cs | 1 - 139 files changed, 602 insertions(+), 601 deletions(-) diff --git a/src/Controls/src/Core/ActionSheetArguments.cs b/src/Controls/src/Core/ActionSheetArguments.cs index 230d32fe1e5a..3a558dbe98d0 100644 --- a/src/Controls/src/Core/ActionSheetArguments.cs +++ b/src/Controls/src/Core/ActionSheetArguments.cs @@ -44,7 +44,6 @@ public ActionSheetArguments(string title, string cancel, string destruction, IEn /// public string Title { get; private set; } - /// public FlowDirection FlowDirection { get; set; } /// @@ -53,4 +52,4 @@ public void SetResult(string result) Result.TrySetResult(result); } } -} \ No newline at end of file +} diff --git a/src/Controls/src/Core/AlertArguments.cs b/src/Controls/src/Core/AlertArguments.cs index 7126663f6bad..d1e39db871c5 100644 --- a/src/Controls/src/Core/AlertArguments.cs +++ b/src/Controls/src/Core/AlertArguments.cs @@ -36,7 +36,6 @@ public AlertArguments(string title, string message, string accept, string cancel /// public TaskCompletionSource Result { get; } - /// public FlowDirection FlowDirection { get; set; } /// @@ -50,4 +49,4 @@ public void SetResult(bool result) Result.TrySetResult(result); } } -} \ No newline at end of file +} diff --git a/src/Controls/src/Core/Animation.cs b/src/Controls/src/Core/Animation.cs index 0722205bae41..397f5f03e13f 100644 --- a/src/Controls/src/Core/Animation.cs +++ b/src/Controls/src/Core/Animation.cs @@ -2,20 +2,32 @@ using System.Collections; using System.Collections.Generic; using BaseAnimation = Microsoft.Maui.Animations.Animation; + namespace Microsoft.Maui.Controls { - /// + /// + /// Encapsulates an animation, a collection of functions that modify properties over a user-perceptible time period. + /// public class Animation : BaseAnimation { bool _finishedTriggered; - /// + /// + /// Creates a new object with default values. + /// public Animation() { Easing = Easing.Linear; } - /// + /// + /// Creates a new object with the specified parameters. + /// + /// An action that is called with successive animation values. + /// The fraction into the current animation at which to start the animation. + /// The fraction into the current animation at which to end the animation. + /// The easing function to use to transition in, out, or in and out of the animation. + /// An action to call when the animation is finished. public Animation(Action callback, double start = 0.0f, double end = 1.0f, Easing easing = null, Action finished = null) : base(callback, start, end - start, easing, finished) { @@ -23,8 +35,12 @@ public Animation(Action callback, double start = 0.0f, double end = 1.0f Func transform = AnimationExtensions.Interpolate(start, end); Step = f => callback(transform(f)); } - - /// + /// + /// Adds an object to this that begins at and finishes at . + /// + /// The fraction into this animation at which the added child animation will begin animating. + /// The fraction into this animation at which the added child animation will stop animating. + /// The animation to add. public void Add(double beginAt, double finishAt, Animation animation) { if (beginAt < 0 || beginAt > 1) @@ -41,13 +57,25 @@ public void Add(double beginAt, double finishAt, Animation animation) childrenAnimations.Add(animation); } - /// + /// + /// Runs the animation with the supplied parameters. + /// + /// The owning animation that will be animated. + /// The name, or handle, that is used to access and track the animation and its state. + /// The time, in milliseconds, between frames. + /// The number of milliseconds over which to interpolate the animation. + /// The easing function to use to transition in, out, or in and out of the animation. + /// An action to call when the animation is finished. + /// A function that should return true if the animation should continue. public void Commit(IAnimatable owner, string name, uint rate = 16, uint length = 250, Easing easing = null, Action finished = null, Func repeat = null) { owner.Animate(name, this, rate, length, easing, finished, repeat); } - /// + /// + /// Returns a callback that recursively runs the eased animation step on this object and those of its children that have begun and not finished. + /// + /// A callback that recursively runs the eased animation step on this object and those of its children that have begun and not finished. public Action GetCallback() { Action result = f => @@ -78,21 +106,30 @@ public Action GetCallback() internal void ResetChildren() => this.Reset(); - /// public override void Reset() { base.Reset(); _finishedTriggered = false; } - /// + /// + /// Adds an object to this that begins at and finishes at . + /// + /// The fraction into this animation at which the added child animation will begin animating. + /// The fraction into this animation at which the added child animation will stop animating. + /// The animation to add. public Animation Insert(double beginAt, double finishAt, Animation animation) { Add(beginAt, finishAt, animation); return this; } - /// + /// + /// Adds to the children of this object and sets the start and end times of to and , respectively. + /// + /// The animation to add. + /// The fraction into this animation at which the added child animation will begin animating. + /// The fraction into this animation at which the added child animation will stop animating. public Animation WithConcurrent(Animation animation, double beginAt = 0.0f, double finishAt = 1.0f) { animation.StartDelay = beginAt; @@ -101,7 +138,15 @@ public Animation WithConcurrent(Animation animation, double beginAt = 0.0f, doub return this; } - /// + /// + /// Creates a new object with the specified , and adds it to the children of this object. + /// + /// An action that is called with successive animation values. + /// The fraction into the current animation at which to start the animation. + /// The fraction into the current animation at which to end the animation. + /// The easing function to use to transition in, out, or in and out of the animation. + /// The fraction into this animation at which the added child animation will begin animating. + /// The fraction into this animation at which the added child animation will stop animating. public Animation WithConcurrent(Action callback, double start = 0.0f, double end = 1.0f, Easing easing = null, double beginAt = 0.0f, double finishAt = 1.0f) { var child = new Animation(callback, start, end, easing); @@ -111,7 +156,9 @@ public Animation WithConcurrent(Action callback, double start = 0.0f, do return this; } - /// + /// + /// Specifies if this animation is currently enabled. + /// public bool IsEnabled { get diff --git a/src/Controls/src/Core/AnimationExtensions.cs b/src/Controls/src/Core/AnimationExtensions.cs index 117f97e2d6b1..32f814b21319 100644 --- a/src/Controls/src/Core/AnimationExtensions.cs +++ b/src/Controls/src/Core/AnimationExtensions.cs @@ -47,7 +47,6 @@ static AnimationExtensions() s_tweeners = new Dictionary(); } - /// public static int Add(this IAnimationManager animationManager, Action step) { var id = s_currentTweener++; @@ -61,7 +60,6 @@ public static int Add(this IAnimationManager animationManager, Action st animation.Commit(animationManager); return id; } - /// public static int Insert(this IAnimationManager animationManager, Func step) { var id = s_currentTweener++; @@ -75,7 +73,6 @@ public static int Insert(this IAnimationManager animationManager, Func public static void Remove(this IAnimationManager animationManager, int tickerId) { var animation = s_tweeners[tickerId]; diff --git a/src/Controls/src/Core/Application.cs b/src/Controls/src/Core/Application.cs index 47a695f25530..8a5680e7a203 100644 --- a/src/Controls/src/Core/Application.cs +++ b/src/Controls/src/Core/Application.cs @@ -180,7 +180,6 @@ public AppTheme UserAppTheme public AppTheme RequestedTheme => UserAppTheme != AppTheme.Unspecified ? UserAppTheme : PlatformAppTheme; static Color? _accentColor; - /// public static Color? AccentColor { get => _accentColor ??= GetAccentColor(); @@ -385,4 +384,4 @@ protected internal virtual void CleanUp() IReadOnlyList IVisualTreeElement.GetVisualChildren() => this.Windows; } -} \ No newline at end of file +} diff --git a/src/Controls/src/Core/AutomationProperties.cs b/src/Controls/src/Core/AutomationProperties.cs index 251fa613f151..e5efa0b30827 100644 --- a/src/Controls/src/Core/AutomationProperties.cs +++ b/src/Controls/src/Core/AutomationProperties.cs @@ -9,7 +9,6 @@ public class AutomationProperties /// public static readonly BindableProperty IsInAccessibleTreeProperty = BindableProperty.Create("IsInAccessibleTree", typeof(bool?), typeof(AutomationProperties), null); - /// public static readonly BindableProperty ExcludedWithChildrenProperty = BindableProperty.Create("ExcludedWithChildren", typeof(bool?), typeof(AutomationProperties), null); /// @@ -30,7 +29,6 @@ public static string GetHelpText(BindableObject bindable) return (bool?)bindable.GetValue(IsInAccessibleTreeProperty); } - /// public static bool? GetExcludedWithChildren(BindableObject bindable) { return (bool?)bindable.GetValue(ExcludedWithChildrenProperty); @@ -61,7 +59,6 @@ public static void SetIsInAccessibleTree(BindableObject bindable, bool? value) bindable.SetValue(IsInAccessibleTreeProperty, value); } - /// public static void SetExcludedWithChildren(BindableObject bindable, bool? value) { bindable.SetValue(ExcludedWithChildrenProperty, value); diff --git a/src/Controls/src/Core/BindableObjectExtensions.cs b/src/Controls/src/Core/BindableObjectExtensions.cs index 6edd507fc1c6..12c9da451776 100644 --- a/src/Controls/src/Core/BindableObjectExtensions.cs +++ b/src/Controls/src/Core/BindableObjectExtensions.cs @@ -42,7 +42,6 @@ public static void SetBinding(this BindableObject self, BindableProperty targetP self.SetBinding(targetProperty, binding); } - /// public static T GetPropertyIfSet(this BindableObject bindableObject, BindableProperty bindableProperty, T returnIfNotSet) { if (bindableObject == null) @@ -54,7 +53,6 @@ public static T GetPropertyIfSet(this BindableObject bindableObject, Bindable return returnIfNotSet; } - /// public static void SetAppTheme(this BindableObject self, BindableProperty targetProperty, T light, T dark) => self.SetBinding(targetProperty, new AppThemeBinding { Light = light, Dark = dark }); /// diff --git a/src/Controls/src/Core/BindablePropertyConverter.cs b/src/Controls/src/Core/BindablePropertyConverter.cs index 5867278ff79d..b9396053636a 100644 --- a/src/Controls/src/Core/BindablePropertyConverter.cs +++ b/src/Controls/src/Core/BindablePropertyConverter.cs @@ -14,11 +14,9 @@ namespace Microsoft.Maui.Controls [Xaml.ProvideCompiled("Microsoft.Maui.Controls.XamlC.BindablePropertyConverter")] public sealed class BindablePropertyConverter : TypeConverter, IExtendedTypeConverter { - /// public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) => sourceType == typeof(string); - /// public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) => true; @@ -74,7 +72,6 @@ object IExtendedTypeConverter.ConvertFromInvariantString(string value, IServiceP throw new XamlParseException($"Can't resolve {value}. Syntax is [[prefix:]Type.]PropertyName.", lineinfo); } - /// public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) { var strValue = value?.ToString(); @@ -144,7 +141,6 @@ Type FindTypeForVisualState(IProvideParentValues parentValueProvider, IXmlLineIn } - /// public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) { if (value is not BindableProperty bp) @@ -152,4 +148,4 @@ public override object ConvertTo(ITypeDescriptorContext context, CultureInfo cul return $"{bp.DeclaringType.Name}.{bp.PropertyName}"; } } -} \ No newline at end of file +} diff --git a/src/Controls/src/Core/Binding.cs b/src/Controls/src/Core/Binding.cs index 224a7e3b33fb..2a869c04f55b 100644 --- a/src/Controls/src/Core/Binding.cs +++ b/src/Controls/src/Core/Binding.cs @@ -9,7 +9,6 @@ namespace Microsoft.Maui.Controls /// public sealed class Binding : BindingBase { - /// public const string SelfPath = "."; IValueConverter _converter; object _converterParameter; diff --git a/src/Controls/src/Core/BrushTypeConverter.cs b/src/Controls/src/Core/BrushTypeConverter.cs index d174eb68d514..01abdea217b4 100644 --- a/src/Controls/src/Core/BrushTypeConverter.cs +++ b/src/Controls/src/Core/BrushTypeConverter.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.ComponentModel; using System.Globalization; @@ -26,15 +26,12 @@ public class BrushTypeConverter : TypeConverter readonly ColorTypeConverter _colorTypeConverter = new ColorTypeConverter(); - /// public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) => sourceType == typeof(string); - /// public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) => false; - /// public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) { var strValue = value?.ToString(); @@ -71,7 +68,6 @@ public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo c } - /// public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) => throw new NotSupportedException(); @@ -410,4 +406,4 @@ bool TryParseOffsets(string[] parts, out float[] result) } } } -} \ No newline at end of file +} diff --git a/src/Controls/src/Core/Button.cs b/src/Controls/src/Core/Button.cs index 48d02da0ef3d..dcf49ca50dc1 100644 --- a/src/Controls/src/Core/Button.cs +++ b/src/Controls/src/Core/Button.cs @@ -8,69 +8,85 @@ namespace Microsoft.Maui.Controls { - /// + /// + /// A button that reacts to touch events. + /// public partial class Button : View, IFontElement, ITextElement, IBorderElement, IButtonController, IElementConfiguration