diff --git a/src/Compatibility/Core/src/Tizen/ResourcePath.cs b/src/Compatibility/Core/src/Tizen/ResourcePath.cs index b1fee46baf59..c8ce5ec99053 100644 --- a/src/Compatibility/Core/src/Tizen/ResourcePath.cs +++ b/src/Compatibility/Core/src/Tizen/ResourcePath.cs @@ -14,7 +14,7 @@ public static string GetPath(string res) return res; } - foreach (AppFW.ResourceManager.Category category in Enum.GetValues()) + foreach (AppFW.ResourceManager.Category category in Enum.GetValues()) { var path = AppFW.ResourceManager.TryGetPath(category, res); diff --git a/src/Controls/samples/Controls.Sample.Embedding/Platforms/Windows/App.xaml.cs b/src/Controls/samples/Controls.Sample.Embedding/Platforms/Windows/App.xaml.cs index bf07c6549e8e..4d19917658ee 100644 --- a/src/Controls/samples/Controls.Sample.Embedding/Platforms/Windows/App.xaml.cs +++ b/src/Controls/samples/Controls.Sample.Embedding/Platforms/Windows/App.xaml.cs @@ -1,4 +1,9 @@ -using Microsoft.UI.Xaml; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Runtime.InteropServices.WindowsRuntime; +using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; using Microsoft.UI.Xaml.Controls.Primitives; using Microsoft.UI.Xaml.Data; @@ -6,11 +11,6 @@ using Microsoft.UI.Xaml.Media; using Microsoft.UI.Xaml.Navigation; using Microsoft.UI.Xaml.Shapes; -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Runtime.InteropServices.WindowsRuntime; using Windows.ApplicationModel; using Windows.ApplicationModel.Activation; using Windows.Foundation; @@ -26,24 +26,24 @@ namespace Maui.Controls.Sample.WinUI; /// public partial class App : Microsoft.UI.Xaml.Application { - /// - /// Initializes the singleton application object. This is the first line of authored code - /// executed, and as such is the logical equivalent of main() or WinMain(). - /// - public App() - { - InitializeComponent(); - } + /// + /// Initializes the singleton application object. This is the first line of authored code + /// executed, and as such is the logical equivalent of main() or WinMain(). + /// + public App() + { + InitializeComponent(); + } - /// - /// Invoked when the application is launched. - /// - /// Details about the launch request and process. - protected override void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs args) - { - m_window = new MainWindow(); - m_window.Activate(); - } + /// + /// Invoked when the application is launched. + /// + /// Details about the launch request and process. + protected override void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs args) + { + m_window = new MainWindow(); + m_window.Activate(); + } - private Microsoft.UI.Xaml.Window? m_window; + private Microsoft.UI.Xaml.Window? m_window; } diff --git a/src/Controls/src/Build.Tasks/SetPropertiesVisitor.cs b/src/Controls/src/Build.Tasks/SetPropertiesVisitor.cs index 816227f82d37..9bceb938782d 100644 --- a/src/Controls/src/Build.Tasks/SetPropertiesVisitor.cs +++ b/src/Controls/src/Build.Tasks/SetPropertiesVisitor.cs @@ -669,7 +669,7 @@ static bool TryParsePath(ILContext context, string path, TypeReference tSourceRe { if (previousPartTypeRef.IsArray) previousPartTypeRef = previousPartTypeRef.GetElementType(); - + previousPartTypeRef.ResolveCached(context.Cache); } diff --git a/src/Controls/src/Core/Compatibility/Handlers/ListView/Tizen/CellContentFactory.cs b/src/Controls/src/Core/Compatibility/Handlers/ListView/Tizen/CellContentFactory.cs index a087f1a06cee..6a68cda7758a 100644 --- a/src/Controls/src/Core/Compatibility/Handlers/ListView/Tizen/CellContentFactory.cs +++ b/src/Controls/src/Core/Compatibility/Handlers/ListView/Tizen/CellContentFactory.cs @@ -1,6 +1,6 @@ #nullable disable -using Microsoft.Maui.Graphics; using Microsoft.Maui.Controls.Internals; +using Microsoft.Maui.Graphics; namespace Microsoft.Maui.Controls.Handlers.Compatibility { diff --git a/src/Controls/src/Core/Handlers/Items/CarouselViewHandler.Windows.cs b/src/Controls/src/Core/Handlers/Items/CarouselViewHandler.Windows.cs index 4d79bddb25a9..c7fef72d8c06 100644 --- a/src/Controls/src/Core/Handlers/Items/CarouselViewHandler.Windows.cs +++ b/src/Controls/src/Core/Handlers/Items/CarouselViewHandler.Windows.cs @@ -23,7 +23,7 @@ public partial class CarouselViewHandler : ItemsViewHandler ScrollViewer _scrollViewer; WScrollBarVisibility? _horizontalScrollBarVisibilityWithoutLoop; WScrollBarVisibility? _verticalScrollBarVisibilityWithoutLoop; - Size _currentSize; + Size _currentSize; bool _isCarouselViewReady; NotifyCollectionChangedEventHandler _collectionChanged; readonly WeakNotifyCollectionChangedProxy _proxy = new(); @@ -195,7 +195,7 @@ public static void MapPosition(CarouselViewHandler handler, CarouselView carouse { handler.UpdatePosition(); } - + } public static void MapIsBounceEnabled(CarouselViewHandler handler, CarouselView carouselView) diff --git a/src/Controls/src/Core/Handlers/Items/ItemsViewHandler.Windows.cs b/src/Controls/src/Core/Handlers/Items/ItemsViewHandler.Windows.cs index 8046dd7e7bf2..d4fe7a8b89c5 100644 --- a/src/Controls/src/Core/Handlers/Items/ItemsViewHandler.Windows.cs +++ b/src/Controls/src/Core/Handlers/Items/ItemsViewHandler.Windows.cs @@ -628,7 +628,7 @@ object FindBoundItem(ScrollToRequestEventArgs args) { // CollectionGroups property is of type IObservableVector, but these objects should implement ICollectionViewGroup var itemGroup = CollectionViewSource.View.CollectionGroups[args.GroupIndex] as ICollectionViewGroup; - if (itemGroup != null && + if (itemGroup != null && args.Index < itemGroup.GroupItems.Count) { return itemGroup.GroupItems[args.Index]; diff --git a/src/Controls/src/Core/Platform/GestureManager/GesturePlatformManager.Windows.cs b/src/Controls/src/Core/Platform/GestureManager/GesturePlatformManager.Windows.cs index ca9b06027c94..cc2cb5497761 100644 --- a/src/Controls/src/Core/Platform/GestureManager/GesturePlatformManager.Windows.cs +++ b/src/Controls/src/Core/Platform/GestureManager/GesturePlatformManager.Windows.cs @@ -286,14 +286,14 @@ public VisualElement? Element if (_element == value) return; - if (_element is View && ElementGestureRecognizers is {} gestureRecognizersBefore) + if (_element is View && ElementGestureRecognizers is { } gestureRecognizersBefore) { gestureRecognizersBefore.CollectionChanged -= _collectionChangedHandler; } _element = value; - if (_element is View && ElementGestureRecognizers is {} gestureRecognizersAfter) + if (_element is View && ElementGestureRecognizers is { } gestureRecognizersAfter) { gestureRecognizersAfter.CollectionChanged += _collectionChangedHandler; } @@ -385,7 +385,7 @@ protected virtual void Dispose(bool disposing) ClearContainerEventHandlers(); - if (_element is View && ElementGestureRecognizers is {} gestureRecognizers) + if (_element is View && ElementGestureRecognizers is { } gestureRecognizers) { gestureRecognizers.CollectionChanged -= _collectionChangedHandler; } @@ -425,7 +425,7 @@ void HandlePan(ManipulationDeltaRoutedEventArgs e, View view) { if (view == null) return; - + _isPanning = true; foreach (IPanGestureController recognizer in view.GestureRecognizers.GetGesturesFor().Where(g => g.TouchPoints == _fingers.Count)) @@ -517,7 +517,7 @@ void OnPointerExited(object sender, PointerRoutedEventArgs e) if (_fingers.Contains(id)) _fingers.Remove(id); } - + SwipeComplete(true); PinchComplete(true); } @@ -756,7 +756,7 @@ void UpdateDragAndDropGestureRecognizers() if (allowDrop) { _subscriptionFlags |= SubscriptionFlags.ContainerDropEventsSubscribed; - + _container.AllowDrop = true; _container.DragOver += HandleDragOver; _container.Drop += HandleDrop; @@ -784,7 +784,7 @@ void UpdatingGestureRecognizers() { _subscriptionFlags |= SubscriptionFlags.ContainerTapAndRightTabEventSubscribed; _tappedEventHandler = new TappedEventHandler(OnTap); - _container.AddHandler(FrameworkElement.TappedEvent,_tappedEventHandler, true); + _container.AddHandler(FrameworkElement.TappedEvent, _tappedEventHandler, true); _container.RightTapped += OnTap; } else diff --git a/src/Controls/src/Core/Platform/Windows/CollectionView/ItemContentControl.cs b/src/Controls/src/Core/Platform/Windows/CollectionView/ItemContentControl.cs index 486a3c85c0f5..3f0cb9be96f4 100644 --- a/src/Controls/src/Core/Platform/Windows/CollectionView/ItemContentControl.cs +++ b/src/Controls/src/Core/Platform/Windows/CollectionView/ItemContentControl.cs @@ -175,7 +175,7 @@ internal void Realize() var content = dataTemplate.CreateContent(); _visualElement = content as VisualElement; - if(_visualElement is null) + if (_visualElement is null) { throw new InvalidOperationException($"{dataTemplate} could not be created from {content}"); } diff --git a/src/Controls/src/Core/Platform/Windows/CollectionView/LoopableCollectionView.cs b/src/Controls/src/Core/Platform/Windows/CollectionView/LoopableCollectionView.cs index 5c4f6105438a..1b84dd2f1f23 100644 --- a/src/Controls/src/Core/Platform/Windows/CollectionView/LoopableCollectionView.cs +++ b/src/Controls/src/Core/Platform/Windows/CollectionView/LoopableCollectionView.cs @@ -191,7 +191,7 @@ IEnumerator IEnumerable.GetEnumerator() return ((IEnumerable)_internal).GetEnumerator(); } - void OnItemsVectorChanged(global::Windows.Foundation.Collections.IObservableVector sender, + void OnItemsVectorChanged(global::Windows.Foundation.Collections.IObservableVector sender, global::Windows.Foundation.Collections.IVectorChangedEventArgs @event) { _vectorChanged.Invoke(sender, @event); diff --git a/src/Controls/src/Core/Platform/Windows/CollectionView/ScrollHelpers.cs b/src/Controls/src/Core/Platform/Windows/CollectionView/ScrollHelpers.cs index 3ac899b2ca0d..f57cf03a9c59 100644 --- a/src/Controls/src/Core/Platform/Windows/CollectionView/ScrollHelpers.cs +++ b/src/Controls/src/Core/Platform/Windows/CollectionView/ScrollHelpers.cs @@ -208,7 +208,7 @@ internal static void JumpToIndexAsync(ListViewBase list, int index, ScrollToPosi public static async Task JumpToItemAsync(ListViewBase list, object targetItem, ScrollToPosition scrollToPosition) { - if(!list.IsLoaded) + if (!list.IsLoaded) { list.OnLoaded(async () => { diff --git a/src/Controls/src/Core/Platform/Windows/Extensions/TextBlockExtensions.cs b/src/Controls/src/Core/Platform/Windows/Extensions/TextBlockExtensions.cs index 41d725179f45..76ccfca3a57f 100644 --- a/src/Controls/src/Core/Platform/Windows/Extensions/TextBlockExtensions.cs +++ b/src/Controls/src/Core/Platform/Windows/Extensions/TextBlockExtensions.cs @@ -109,7 +109,7 @@ internal static void SetLineBreakMode(this TextBlock textBlock, LineBreakMode li throw new ArgumentOutOfRangeException(); } } - + internal static void SetTextReadingOrder(this TextBlock platformControl, bool detectReadingOrderFromContent) => platformControl.TextReadingOrder = detectReadingOrderFromContent ? TextReadingOrder.DetectFromContent diff --git a/src/Controls/tests/DeviceTests/Elements/Border/BorderTests.Windows.cs b/src/Controls/tests/DeviceTests/Elements/Border/BorderTests.Windows.cs index 65e995b587d6..82b35e999e42 100644 --- a/src/Controls/tests/DeviceTests/Elements/Border/BorderTests.Windows.cs +++ b/src/Controls/tests/DeviceTests/Elements/Border/BorderTests.Windows.cs @@ -24,12 +24,12 @@ public async Task InnerCornerRadiusInitializesCorrectly(int cornerRadius) var border = new Border() { - Content = new Label - { - Text = "Background", - TextColor = Colors.Red, - FontFamily = "Segoe UI", - HorizontalOptions = LayoutOptions.Center, + Content = new Label + { + Text = "Background", + TextColor = Colors.Red, + FontFamily = "Segoe UI", + HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center }, HorizontalOptions = LayoutOptions.Center, diff --git a/src/Controls/tests/DeviceTests/Elements/Shell/ShellTests.Windows.cs b/src/Controls/tests/DeviceTests/Elements/Shell/ShellTests.Windows.cs index 4bbcc4c27276..b1932396b75a 100644 --- a/src/Controls/tests/DeviceTests/Elements/Shell/ShellTests.Windows.cs +++ b/src/Controls/tests/DeviceTests/Elements/Shell/ShellTests.Windows.cs @@ -13,10 +13,10 @@ using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; using Xunit; +using static Microsoft.Maui.DeviceTests.AssertHelpers; using NavigationView = Microsoft.UI.Xaml.Controls.NavigationView; using WFrameworkElement = Microsoft.UI.Xaml.FrameworkElement; using WNavigationViewItem = Microsoft.UI.Xaml.Controls.NavigationViewItem; -using static Microsoft.Maui.DeviceTests.AssertHelpers; namespace Microsoft.Maui.DeviceTests diff --git a/src/Controls/tests/DeviceTests/Elements/Window/WindowTests.Windows.cs b/src/Controls/tests/DeviceTests/Elements/Window/WindowTests.Windows.cs index 39ea47319a41..097485c5af89 100644 --- a/src/Controls/tests/DeviceTests/Elements/Window/WindowTests.Windows.cs +++ b/src/Controls/tests/DeviceTests/Elements/Window/WindowTests.Windows.cs @@ -10,8 +10,8 @@ using Microsoft.Maui.Platform; using Microsoft.UI.Windowing; using Xunit; -using WPanel = Microsoft.UI.Xaml.Controls.Panel; using static Microsoft.Maui.DeviceTests.AssertHelpers; +using WPanel = Microsoft.UI.Xaml.Controls.Panel; namespace Microsoft.Maui.DeviceTests { diff --git a/src/Controls/tests/DeviceTests/Stubs/MauiAppNewWindowStub.Windows.cs b/src/Controls/tests/DeviceTests/Stubs/MauiAppNewWindowStub.Windows.cs index 6223b70922ab..f9c10a1d1c65 100644 --- a/src/Controls/tests/DeviceTests/Stubs/MauiAppNewWindowStub.Windows.cs +++ b/src/Controls/tests/DeviceTests/Stubs/MauiAppNewWindowStub.Windows.cs @@ -116,8 +116,8 @@ public void OpenWindow(IWindow window) throw new NotImplementedException(); } - public void ActivateWindow(IWindow window) - { + public void ActivateWindow(IWindow window) + { throw new NotImplementedException(); } diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue23674.xaml.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue23674.xaml.cs index d0f6ab5a9fe2..134e80010131 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/Issue23674.xaml.cs +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue23674.xaml.cs @@ -4,7 +4,7 @@ [Issue(IssueTracker.Github, 23674, "Page.IsBusy activity indicators gets stuck/causes multiple to be displayed", PlatformAffected.Android)] public class Issue23674 : NavigationPage { - public Issue23674() : base(new Issue23674Page1()){ } + public Issue23674() : base(new Issue23674Page1()) { } class Issue23674Page1 : ContentPage { @@ -16,7 +16,7 @@ public Issue23674Page1() VerticalOptions = LayoutOptions.Start, Text = "Navigate to page 1", HeightRequest = 100, - Command = new Command(async ()=> + Command = new Command(async () => { await Navigation.PushAsync(new Issue23674Page2()); }) diff --git a/src/Controls/tests/TestCases.HostApp/Issues/XFIssue/Issue1342.cs b/src/Controls/tests/TestCases.HostApp/Issues/XFIssue/Issue1342.cs index dbb3378b3916..5832bccecc5e 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/XFIssue/Issue1342.cs +++ b/src/Controls/tests/TestCases.HostApp/Issues/XFIssue/Issue1342.cs @@ -40,7 +40,7 @@ public class MainPageCode : TabbedPage { public MainPageCode() { - ToolbarItems.Add(new Microsoft.Maui.Controls.ToolbarItem() { Text = "add1" , AutomationId = "add1" }); + ToolbarItems.Add(new Microsoft.Maui.Controls.ToolbarItem() { Text = "add1", AutomationId = "add1" }); ToolbarItems.Add(new Microsoft.Maui.Controls.ToolbarItem() { Text = $"{add2}", AutomationId = add2 }); ToolbarItems.Add(new Microsoft.Maui.Controls.ToolbarItem() { Text = $"{add3}", AutomationId = add3 }); ToolbarItems.Add(new Microsoft.Maui.Controls.ToolbarItem() { Text = "reload" }); diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue25192.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue25192.cs index c84bc1dcfb42..cb31d8eac551 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue25192.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue25192.cs @@ -4,20 +4,20 @@ namespace Microsoft.Maui.TestCases.Tests.Issues { - public class Issue25192 : _IssuesUITest - { - public Issue25192(TestDevice testDevice) : base(testDevice) - { - } + public class Issue25192 : _IssuesUITest + { + public Issue25192(TestDevice testDevice) : base(testDevice) + { + } - public override string Issue => "CarouselView Loop='False' renders incorrectly items"; + public override string Issue => "CarouselView Loop='False' renders incorrectly items"; - [Test] - [Category(UITestCategories.CarouselView)] - public void CarouselViewShouldRenderCorrectly() - { - App.WaitForElement("Item1"); - VerifyScreenshot(); - } - } + [Test] + [Category(UITestCategories.CarouselView)] + public void CarouselViewShouldRenderCorrectly() + { + App.WaitForElement("Item1"); + VerifyScreenshot(); + } + } } diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Maui25819.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Maui25819.xaml.cs index e5579b0bb548..fa3e97ae4b4a 100644 --- a/src/Controls/tests/Xaml.UnitTests/Issues/Maui25819.xaml.cs +++ b/src/Controls/tests/Xaml.UnitTests/Issues/Maui25819.xaml.cs @@ -40,14 +40,14 @@ public void TearDown() AppInfo.SetCurrent(null); } - + [Test] - public void DoesntThrow([Values]bool inflator) + public void DoesntThrow([Values] bool inflator) { MockCompiler.Compile(typeof(Maui25819)); var layout = new Maui25819(inflator); layout.BindingContext = new Maui25819UserDataViewModel(); - Assert.That(layout.label0.Text, Is.EqualTo("2023")); + Assert.That(layout.label0.Text, Is.EqualTo("2023")); } } } @@ -79,15 +79,15 @@ public Maui25819UserDataViewModel() public class Maui25819UsersDataModel { - public Maui25819InstalmentPlans InstalmentPlans { get; set; } = new(); + public Maui25819InstalmentPlans InstalmentPlans { get; set; } = new(); } public class Maui25819InstalmentPlans { - public Maui25819InstalmentPlan[] InstalmentPlan { get; set; } = []; + public Maui25819InstalmentPlan[] InstalmentPlan { get; set; } = []; } public class Maui25819InstalmentPlan { - public string FinancialYear { get; set; } = string.Empty; + public string FinancialYear { get; set; } = string.Empty; } \ No newline at end of file diff --git a/src/Core/src/Handlers/Application/ApplicationHandler.Windows.cs b/src/Core/src/Handlers/Application/ApplicationHandler.Windows.cs index ba41e3c65d04..e3327585adb1 100644 --- a/src/Core/src/Handlers/Application/ApplicationHandler.Windows.cs +++ b/src/Core/src/Handlers/Application/ApplicationHandler.Windows.cs @@ -22,7 +22,7 @@ public static partial void MapCloseWindow(ApplicationHandler handler, IApplicati (window.Handler?.PlatformView as Window)?.Close(); } } - + public static partial void MapActivateWindow(ApplicationHandler handler, IApplication application, object? args) { if (args is IWindow window) diff --git a/src/Core/src/Handlers/Entry/EntryHandler.Windows.cs b/src/Core/src/Handlers/Entry/EntryHandler.Windows.cs index 6b7ec0c2d829..0376cb93f541 100644 --- a/src/Core/src/Handlers/Entry/EntryHandler.Windows.cs +++ b/src/Core/src/Handlers/Entry/EntryHandler.Windows.cs @@ -17,7 +17,7 @@ public partial class EntryHandler : ViewHandler protected override TextBox CreatePlatformView() => new MauiPasswordTextBox() { - IsObfuscationDelayed = s_shouldBeDelayed + MauiPasswordTextBox.IsObfuscationDelayed = s_shouldBeDelayed }; public override void SetVirtualView(IView view) @@ -109,7 +109,7 @@ public static void MapSelectionLength(IEntryHandler handler, IEntry entry) => void OnPlatformTextChanged(object sender, TextChangedEventArgs args) { if (PlatformView is MauiPasswordTextBox passwordBox) - VirtualView?.UpdateText(passwordBox.Password); + VirtualView?.UpdateText(MauiPasswordTextBox.Password); else VirtualView?.UpdateText(PlatformView.Text); } diff --git a/src/Core/src/Handlers/FlyoutView/FlyoutViewHandler.Windows.cs b/src/Core/src/Handlers/FlyoutView/FlyoutViewHandler.Windows.cs index bd5f2499cb5d..c12e562fbc93 100644 --- a/src/Core/src/Handlers/FlyoutView/FlyoutViewHandler.Windows.cs +++ b/src/Core/src/Handlers/FlyoutView/FlyoutViewHandler.Windows.cs @@ -48,7 +48,7 @@ static void UpdateFlyout(IFlyoutViewHandler handler) if (handler.PlatformView is RootNavigationView rnv) rnv.FlyoutView = handler.VirtualView.Flyout; - handler.PlatformView.FlyoutCustomContent = handler.VirtualView.Flyout?.ToPlatform(handler.MauiContext); + MauiNavigationView.FlyoutCustomContent = handler.VirtualView.Flyout?.ToPlatform(handler.MauiContext); } public static void MapDetail(IFlyoutViewHandler handler, IFlyoutView flyoutView) diff --git a/src/Core/src/Handlers/HybridWebView/HybridWebViewHandler.Tizen.cs b/src/Core/src/Handlers/HybridWebView/HybridWebViewHandler.Tizen.cs index 036e044634bb..c686585c373e 100644 --- a/src/Core/src/Handlers/HybridWebView/HybridWebViewHandler.Tizen.cs +++ b/src/Core/src/Handlers/HybridWebView/HybridWebViewHandler.Tizen.cs @@ -2,7 +2,7 @@ namespace Microsoft.Maui.Handlers { - public partial class HybridWebViewHandler : ViewHandler + public partial class HybridWebViewHandler : ViewHandler { protected override Tizen.NUI.BaseComponents.View CreatePlatformView() => throw new NotImplementedException(); diff --git a/src/Core/src/Handlers/SearchBar/SearchBarHandler.Windows.cs b/src/Core/src/Handlers/SearchBar/SearchBarHandler.Windows.cs index b31d8c58ae26..f2aa5e76feff 100644 --- a/src/Core/src/Handlers/SearchBar/SearchBarHandler.Windows.cs +++ b/src/Core/src/Handlers/SearchBar/SearchBarHandler.Windows.cs @@ -5,7 +5,7 @@ namespace Microsoft.Maui.Handlers { public partial class SearchBarHandler : ViewHandler { - public AutoSuggestBox? QueryEditor => null; + public static AutoSuggestBox? QueryEditor => null; protected override AutoSuggestBox CreatePlatformView() => new AutoSuggestBox { diff --git a/src/Core/src/Handlers/WebView/WebViewHandler.Windows.cs b/src/Core/src/Handlers/WebView/WebViewHandler.Windows.cs index aca4648bb4b2..4fab78faf38b 100644 --- a/src/Core/src/Handlers/WebView/WebViewHandler.Windows.cs +++ b/src/Core/src/Handlers/WebView/WebViewHandler.Windows.cs @@ -145,7 +145,7 @@ void ProcessFailed(CoreWebView2 sender, CoreWebView2ProcessFailedEventArgs args) { SendProcessFailed(args); } - + async void SendNavigated(string url, WebNavigationEvent evnt, WebNavigationResult result) { if (VirtualView is not null) diff --git a/src/Core/src/Hosting/Internal/MauiServiceCollection.cs b/src/Core/src/Hosting/Internal/MauiServiceCollection.cs index 201fd6811b31..76824da75c2b 100644 --- a/src/Core/src/Hosting/Internal/MauiServiceCollection.cs +++ b/src/Core/src/Hosting/Internal/MauiServiceCollection.cs @@ -13,7 +13,7 @@ class MauiServiceCollection : IMauiServiceCollection public int Count => _descriptors.Count; - public bool IsReadOnly => false; + public static bool IsReadOnly => false; public ServiceDescriptor this[int index] { diff --git a/src/Core/src/Hosting/MauiAppBuilder.cs b/src/Core/src/Hosting/MauiAppBuilder.cs index 77791baa7f10..fb24b804db40 100644 --- a/src/Core/src/Hosting/MauiAppBuilder.cs +++ b/src/Core/src/Hosting/MauiAppBuilder.cs @@ -182,11 +182,11 @@ private void ConfigureDefaultLogging() private sealed class NullLoggerFactory : ILoggerFactory { - public void AddProvider(ILoggerProvider provider) { } + public static void AddProvider(ILoggerProvider provider) { } public ILogger CreateLogger(string categoryName) => NullLogger.Instance; - public void Dispose() { } + public static void Dispose() { } } private sealed class NullLogger : ILogger, IDisposable @@ -195,9 +195,9 @@ private sealed class NullLogger : ILogger, IDisposable public void Dispose() { } - public bool IsEnabled(LogLevel logLevel) => false; + public static bool IsEnabled(LogLevel logLevel) => false; - public void Log(LogLevel logLevel, EventId eventId, TState state, Exception? exception, Func formatter) + public static void Log(LogLevel logLevel, EventId eventId, TState state, Exception? exception, Func formatter) { } } diff --git a/src/Core/src/ImageSources/FontImageSourceService/FontImageSourceService.Windows.cs b/src/Core/src/ImageSources/FontImageSourceService/FontImageSourceService.Windows.cs index 6d2ad3196bdd..36e16f64ced3 100644 --- a/src/Core/src/ImageSources/FontImageSourceService/FontImageSourceService.Windows.cs +++ b/src/Core/src/ImageSources/FontImageSourceService/FontImageSourceService.Windows.cs @@ -136,7 +136,7 @@ string GetFontSource(IFontImageSource imageSource) } var fontUri = new Uri(fontSource, UriKind.RelativeOrAbsolute); - + var path = fontUri.AbsolutePath.TrimStart('/'); if (FileSystemUtils.TryGetAppPackageFileUri(path, out var uri)) { diff --git a/src/Core/src/Platform/Windows/ActivityIndicatorExtensions.cs b/src/Core/src/Platform/Windows/ActivityIndicatorExtensions.cs index 9b7a5911a1b3..274dd4f35084 100644 --- a/src/Core/src/Platform/Windows/ActivityIndicatorExtensions.cs +++ b/src/Core/src/Platform/Windows/ActivityIndicatorExtensions.cs @@ -25,7 +25,7 @@ public static void UpdateColor(this ProgressRing platformActivityIndicator, IAct if (color.IsDefault()) { - if(foregroundDefault is Brush defaultBrush) + if (foregroundDefault is Brush defaultBrush) brush = defaultBrush; } else diff --git a/src/Core/src/Platform/Windows/ColorConverter.cs b/src/Core/src/Platform/Windows/ColorConverter.cs index 4ef57acc9451..80d8c593e68e 100644 --- a/src/Core/src/Platform/Windows/ColorConverter.cs +++ b/src/Core/src/Platform/Windows/ColorConverter.cs @@ -7,7 +7,7 @@ namespace Microsoft.Maui.Platform { public sealed class ColorConverter : UI.Xaml.Data.IValueConverter { - public object Convert(object value, Type targetType, object parameter, string language) + public static object Convert(object value, Type targetType, object parameter, string language) { var color = (Graphics.Color)value; var defaultColorKey = (string)parameter; diff --git a/src/Core/src/Platform/Windows/MauiNavigationView.cs b/src/Core/src/Platform/Windows/MauiNavigationView.cs index 6dd485acf974..9077e888bb7b 100644 --- a/src/Core/src/Platform/Windows/MauiNavigationView.cs +++ b/src/Core/src/Platform/Windows/MauiNavigationView.cs @@ -188,7 +188,7 @@ internal static readonly DependencyProperty ToolbarProperty = DependencyProperty.Register(nameof(Toolbar), typeof(UIElement), typeof(MauiNavigationView), new PropertyMetadata(null, (d, _) => ((RootNavigationView)d).ToolbarChanged())); - internal UIElement? Toolbar + internal static UIElement? Toolbar { get => (UIElement?)GetValue(ToolbarProperty); set => SetValue(ToolbarProperty, value); @@ -196,7 +196,7 @@ internal UIElement? Toolbar protected private virtual void ToolbarChanged() { - Header = Toolbar; + Header = MauiNavigationView.Toolbar; } #endregion @@ -206,7 +206,7 @@ public static readonly DependencyProperty NavigationViewBackButtonMarginProperty = DependencyProperty.Register(nameof(NavigationViewBackButtonMargin), typeof(WThickness), typeof(MauiNavigationView), new PropertyMetadata(new WThickness(4, 2, 0, 2), NavigationViewBackButtonMarginChanged)); - public WThickness NavigationViewBackButtonMargin + public static WThickness NavigationViewBackButtonMargin { get => (WThickness)GetValue(NavigationViewBackButtonMarginProperty); set => SetValue(NavigationViewBackButtonMarginProperty, value); @@ -220,10 +220,10 @@ static void NavigationViewBackButtonMarginChanged(DependencyObject d, Dependency void UpdateNavigationViewBackButtonMargin() { if (NavigationViewBackButton != null) - NavigationViewBackButton.Margin = NavigationViewBackButtonMargin; + NavigationViewBackButton.Margin = MauiNavigationView.NavigationViewBackButtonMargin; if (NavigationViewCloseButton != null) - NavigationViewCloseButton.Margin = NavigationViewBackButtonMargin; + NavigationViewCloseButton.Margin = MauiNavigationView.NavigationViewBackButtonMargin; } #endregion @@ -232,7 +232,7 @@ internal static readonly DependencyProperty NavigationViewButtonHolderGridMargin = DependencyProperty.Register(nameof(NavigationViewButtonHolderGridMargin), typeof(WThickness), typeof(MauiNavigationView), new PropertyMetadata((WThickness)Application.Current.Resources["NavigationViewButtonHolderGridMargin"], NavigationViewButtonHolderGridMarginChanged)); - internal WThickness NavigationViewButtonHolderGridMargin + internal static WThickness NavigationViewButtonHolderGridMargin { get => (WThickness)GetValue(NavigationViewButtonHolderGridMarginProperty); set => SetValue(NavigationViewButtonHolderGridMarginProperty, value); @@ -246,7 +246,7 @@ static void NavigationViewButtonHolderGridMarginChanged(DependencyObject d, Depe void UpdateNavigationViewButtonHolderGridMargin() { if (ButtonHolderGrid != null) - ButtonHolderGrid.Margin = NavigationViewButtonHolderGridMargin; + ButtonHolderGrid.Margin = MauiNavigationView.NavigationViewButtonHolderGridMargin; } #endregion @@ -259,7 +259,7 @@ internal static readonly DependencyProperty NavigationBackButtonHeightProperty = DependencyProperty.Register(nameof(NavigationBackButtonHeight), typeof(double), typeof(MauiNavigationView), new PropertyMetadata(DefaultNavigationBackButtonHeight, OnNavigationBackButtonSizeChanged)); - internal double NavigationBackButtonHeight + internal static double NavigationBackButtonHeight { get => (double)GetValue(NavigationBackButtonHeightProperty); set => SetValue(NavigationBackButtonHeightProperty, value); @@ -269,7 +269,7 @@ internal static readonly DependencyProperty NavigationBackButtonWidthProperty = DependencyProperty.Register(nameof(NavigationBackButtonWidth), typeof(double), typeof(MauiNavigationView), new PropertyMetadata(DefaultNavigationBackButtonWidth, OnNavigationBackButtonSizeChanged)); - internal double NavigationBackButtonWidth + internal static double NavigationBackButtonWidth { get => (double)GetValue(NavigationBackButtonWidthProperty); set => SetValue(NavigationBackButtonWidthProperty, value); @@ -285,17 +285,17 @@ void UpdateNavigationBackButtonSize() { if (NavigationViewBackButton != null && NavigationViewCloseButton != null) { - if (NavigationViewBackButton.Height != NavigationBackButtonHeight) - NavigationViewBackButton.Height = NavigationBackButtonHeight; + if (NavigationViewBackButton.Height != MauiNavigationView.NavigationBackButtonHeight) + NavigationViewBackButton.Height = MauiNavigationView.NavigationBackButtonHeight; - if (NavigationViewBackButton.Width != NavigationBackButtonWidth) - NavigationViewBackButton.Width = NavigationBackButtonWidth; + if (NavigationViewBackButton.Width != MauiNavigationView.NavigationBackButtonWidth) + NavigationViewBackButton.Width = MauiNavigationView.NavigationBackButtonWidth; - if (NavigationViewCloseButton.Height != NavigationBackButtonHeight) - NavigationViewCloseButton.Height = NavigationBackButtonHeight; + if (NavigationViewCloseButton.Height != MauiNavigationView.NavigationBackButtonHeight) + NavigationViewCloseButton.Height = MauiNavigationView.NavigationBackButtonHeight; - if (NavigationViewCloseButton.Width != NavigationBackButtonWidth) - NavigationViewCloseButton.Width = NavigationBackButtonWidth; + if (NavigationViewCloseButton.Width != MauiNavigationView.NavigationBackButtonWidth) + NavigationViewCloseButton.Width = MauiNavigationView.NavigationBackButtonWidth; } } #endregion @@ -305,7 +305,7 @@ internal static readonly DependencyProperty FlyoutCustomContentProperty = DependencyProperty.Register(nameof(FlyoutCustomContent), typeof(UIElement), typeof(MauiNavigationView), new PropertyMetadata(null, (d, _) => ((RootNavigationView)d).UpdateFlyoutCustomContent())); - internal UIElement? FlyoutCustomContent + internal static UIElement? FlyoutCustomContent { get => (UIElement?)GetValue(FlyoutCustomContentProperty); set => SetValue(FlyoutCustomContentProperty, value); @@ -313,7 +313,7 @@ internal UIElement? FlyoutCustomContent protected private virtual void UpdateFlyoutCustomContent() { - PaneCustomContent = FlyoutCustomContent; + PaneCustomContent = MauiNavigationView.FlyoutCustomContent; } #endregion @@ -330,7 +330,7 @@ internal static readonly DependencyProperty PaneToggleButtonPaddingProperty = DependencyProperty.Register(nameof(PaneToggleButtonPadding), typeof(WThickness), typeof(MauiNavigationView), new PropertyMetadata(DefaultPaneToggleButtonPadding, OnPaneToggleButtonSizeChanged)); - internal WThickness PaneToggleButtonPadding + internal static WThickness PaneToggleButtonPadding { get => (WThickness)GetValue(PaneToggleButtonPaddingProperty); set => SetValue(PaneToggleButtonPaddingProperty, value); @@ -340,7 +340,7 @@ internal static readonly DependencyProperty PaneToggleButtonHeightProperty = DependencyProperty.Register(nameof(PaneToggleButtonHeight), typeof(double), typeof(MauiNavigationView), new PropertyMetadata(DefaultPaneToggleButtonHeight, OnPaneToggleButtonSizeChanged)); - internal double PaneToggleButtonHeight + internal static double PaneToggleButtonHeight { get => (double)GetValue(PaneToggleButtonHeightProperty); set => SetValue(PaneToggleButtonHeightProperty, value); @@ -351,7 +351,7 @@ internal static readonly DependencyProperty PaneToggleButtonWidthProperty new PropertyMetadata(DefaultPaneToggleButtonWidth, OnPaneToggleButtonSizeChanged)); private NavigationViewPaneDisplayMode? _pinPaneDisplayModeTo; - internal double PaneToggleButtonWidth + internal static double PaneToggleButtonWidth { get => (double)GetValue(PaneToggleButtonWidthProperty); set => SetValue(PaneToggleButtonWidthProperty, value); @@ -367,34 +367,34 @@ void UpdatePaneToggleButtonSize() { if (TogglePaneButton != null) { - if (PaneToggleButtonHeight != TogglePaneButton.Height) + if (MauiNavigationView.PaneToggleButtonHeight != TogglePaneButton.Height) { - TogglePaneButton.Height = PaneToggleButtonHeight; - var togglePaneButtonMinHeight = Math.Min((double)Application.Current.Resources["PaneToggleButtonHeight"], PaneToggleButtonHeight); + TogglePaneButton.Height = MauiNavigationView.PaneToggleButtonHeight; + var togglePaneButtonMinHeight = Math.Min((double)Application.Current.Resources["PaneToggleButtonHeight"], MauiNavigationView.PaneToggleButtonHeight); if (TogglePaneButton.MinHeight != togglePaneButtonMinHeight) TogglePaneButton.MinHeight = togglePaneButtonMinHeight; } if (TogglePaneButton.GetFirstDescendant() is Grid grid) { - if (grid.Height != PaneToggleButtonHeight) - grid.Height = PaneToggleButtonHeight; + if (grid.Height != MauiNavigationView.PaneToggleButtonHeight) + grid.Height = MauiNavigationView.PaneToggleButtonHeight; // The row definition is bound to PaneToggleButtonHeight // the height is bound to MinHeight of the button - if (grid.RowDefinitions[0].Height.Value != PaneToggleButtonHeight) - grid.RowDefinitions[0].Height = new WGridLength(PaneToggleButtonHeight); + if (grid.RowDefinitions[0].Height.Value != MauiNavigationView.PaneToggleButtonHeight) + grid.RowDefinitions[0].Height = new WGridLength(MauiNavigationView.PaneToggleButtonHeight); } - if (PaneToggleButtonWidth != TogglePaneButton.Width) - TogglePaneButton.Width = PaneToggleButtonWidth; + if (MauiNavigationView.PaneToggleButtonWidth != TogglePaneButton.Width) + TogglePaneButton.Width = MauiNavigationView.PaneToggleButtonWidth; - var togglePaneButtonMinWidth = Math.Min((double)Application.Current.Resources["PaneToggleButtonWidth"], PaneToggleButtonWidth); + var togglePaneButtonMinWidth = Math.Min((double)Application.Current.Resources["PaneToggleButtonWidth"], MauiNavigationView.PaneToggleButtonWidth); if (TogglePaneButton.MinWidth != togglePaneButtonMinWidth) TogglePaneButton.MinWidth = togglePaneButtonMinWidth; - if (TogglePaneButton.Padding != PaneToggleButtonPadding) - TogglePaneButton.Padding = PaneToggleButtonPadding; + if (TogglePaneButton.Padding != MauiNavigationView.PaneToggleButtonPadding) + TogglePaneButton.Padding = MauiNavigationView.PaneToggleButtonPadding; } } #endregion diff --git a/src/Core/src/Platform/Windows/MauiPasswordTextBox.cs b/src/Core/src/Platform/Windows/MauiPasswordTextBox.cs index ea9c11da589c..7ef26d48ca3c 100644 --- a/src/Core/src/Platform/Windows/MauiPasswordTextBox.cs +++ b/src/Core/src/Platform/Windows/MauiPasswordTextBox.cs @@ -70,27 +70,47 @@ public MauiPasswordTextBox() static void OnInputScopePropertyChanged(DependencyObject sender, DependencyProperty dp) { + +/* Unmerged change from project 'Core(net9.0-windows10.0.20348.0)' +Before: if (sender is not MauiPasswordTextBox mauiTxtBox || mauiTxtBox.IsPassword) +After: + if (sender is not MauiPasswordTextBox mauiTxtBox || IsPassword) +*/ + if (sender is not MauiPasswordTextBox mauiTxtBox || MauiPasswordTextBox.IsPassword) { return; } + +/* Unmerged change from project 'Core(net9.0-windows10.0.20348.0)' +Before: mauiTxtBox.IsPassword = mauiTxtBox.InputScope?.Names?.Any(x => x.NameValue == InputScopeNameValue.Password) ?? false; } + public bool IsPassword +After: + IsPassword = mauiTxtBox.InputScope?.Names?.Any(x => x.NameValue == InputScopeNameValue.Password) ?? false; + } + + public static bool IsPassword +*/ + MauiPasswordTextBox.IsPassword = mauiTxtBox.InputScope?.Names?.Any(x => x.NameValue == InputScopeNameValue.Password) ?? false; + } + public bool IsPassword { get => (bool)GetValue(IsPasswordProperty); set => SetValue(IsPasswordProperty, value); } - public string Password + public static string Password { get => (string)GetValue(PasswordProperty); set => SetValue(PasswordProperty, value); } - public bool IsObfuscationDelayed + public static bool IsObfuscationDelayed { get => (bool)GetValue(IsObfuscationDelayedProperty); set => SetValue(IsObfuscationDelayedProperty, value); @@ -108,7 +128,7 @@ public bool IsObfuscationDelayed // handled accordingly. protected override void OnKeyDown(KeyRoutedEventArgs e) { - if (!IsPassword) + if (!MauiPasswordTextBox.IsPassword) { base.OnKeyDown(e); return; @@ -157,7 +177,7 @@ private void OnNativeTextChanging(TextBox sender, TextBoxTextChangingEventArgs a // but when IsPassword=true, it is too late to handle it at that moment, as we have already // obfuscated the text and have lost the real CursorPosition value. So, let's handle that // issue here when IsPassword is enabled. - if (!IsPassword) + if (!MauiPasswordTextBox.IsPassword) return; // As we are obfuscating the text by ourselves we are setting the Text property directly on code many times. @@ -165,9 +185,9 @@ private void OnNativeTextChanging(TextBox sender, TextBoxTextChangingEventArgs a // to the beginning of the TextBox. // To avoid this behavior let's save the current cursor position of the first time the Text is updated by the user // and keep the same cursor position after each Text update until a new Text update by the user happens. - var updatedPassword = DetermineTextFromPassword(Password, SelectionStart, Text); + var updatedPassword = DetermineTextFromPassword(MauiPasswordTextBox.Password, SelectionStart, Text); - if (Password != updatedPassword) + if (MauiPasswordTextBox.Password != updatedPassword) { _cachedCursorPosition = SelectionStart; _cachedTextLength = updatedPassword.Length; @@ -182,21 +202,21 @@ private void OnNativeTextChanging(TextBox sender, TextBoxTextChangingEventArgs a void OnNativeTextChanged(object sender, TextChangedEventArgs textChangedEventArgs) { - if (IsPassword) + if (MauiPasswordTextBox.IsPassword) { - if (IsObfuscationDelayed) + if (MauiPasswordTextBox.IsObfuscationDelayed) DelayObfuscation(); else ImmediateObfuscation(); } - else if (Text != Password) + else if (Text != MauiPasswordTextBox.Password) { // Not in password mode, so we just need to make the "real" text match // what's in the textbox; the internalChange flag keeps the TextProperty // synchronization from happening _internalChangeFlag = true; - Password = Text; + MauiPasswordTextBox.Password = Text; _internalChangeFlag = false; } } @@ -206,7 +226,7 @@ void UpdateVisibleText() if (_internalChangeFlag) return; - var updatedText = IsPassword ? Obfuscate(Password) : Password; + var updatedText = MauiPasswordTextBox.IsPassword ? Obfuscate(MauiPasswordTextBox.Password) : MauiPasswordTextBox.Password; if (Text != updatedText) Text = updatedText; @@ -214,7 +234,7 @@ void UpdateVisibleText() void UpdateInputScope() { - if (!IsPassword) + if (!MauiPasswordTextBox.IsPassword) { InputScope = _cachedInputScope; IsSpellCheckEnabled = _cachedSpellCheckSetting; @@ -247,7 +267,7 @@ void ImmediateObfuscation() void DelayObfuscation() { - var lengthDifference = Text.Length - Password.Length; + var lengthDifference = Text.Length - MauiPasswordTextBox.Password.Length; UpdatePasswordIfNeeded(); @@ -260,13 +280,13 @@ void DelayObfuscation() { // Either More than one character got added in this text change (e.g., a paste operation) // Or characters were removed. Either way, we don't need to do the delayed obfuscation dance - updatedVisibleText = Obfuscate(Password); + updatedVisibleText = Obfuscate(MauiPasswordTextBox.Password); } else { // Only one character was added; we need to leave it visible for a brief time period // Obfuscate all but the last character for now - updatedVisibleText = Obfuscate(Password, true); + updatedVisibleText = Obfuscate(MauiPasswordTextBox.Password, true); // Leave the last character visible until a new character is added // or sufficient time has passed @@ -295,10 +315,10 @@ void StartTimeout(CancellationToken token) void UpdatePasswordIfNeeded() { - var updatedPassword = DetermineTextFromPassword(Password, SelectionStart, Text); + var updatedPassword = DetermineTextFromPassword(MauiPasswordTextBox.Password, SelectionStart, Text); - if (Password != updatedPassword) - Password = updatedPassword; + if (MauiPasswordTextBox.Password != updatedPassword) + MauiPasswordTextBox.Password = updatedPassword; } static string Obfuscate(string text, bool leaveLastVisible = false) diff --git a/src/Core/src/Platform/Windows/MauiSlider.cs b/src/Core/src/Platform/Windows/MauiSlider.cs index 1fcc5f660c32..ed4c65bea492 100644 --- a/src/Core/src/Platform/Windows/MauiSlider.cs +++ b/src/Core/src/Platform/Windows/MauiSlider.cs @@ -33,7 +33,7 @@ void UpdateThumbStyle() return; } - WImageSource imageSource = ThumbImageSource; + WImageSource imageSource = MauiSlider.ThumbImageSource; if (imageSource != null) { _thumb.Style = ImageThumbStyle; @@ -46,7 +46,7 @@ void UpdateThumbStyle() } } - public WImageSource ThumbImageSource + public static WImageSource ThumbImageSource { get { return (WImageSource)GetValue(ThumbImageSourceProperty); } set { SetValue(ThumbImageSourceProperty, value); } diff --git a/src/Core/src/Platform/Windows/MauiToolbar.xaml.cs b/src/Core/src/Platform/Windows/MauiToolbar.xaml.cs index 320732b148b1..d929086af1b2 100644 --- a/src/Core/src/Platform/Windows/MauiToolbar.xaml.cs +++ b/src/Core/src/Platform/Windows/MauiToolbar.xaml.cs @@ -31,7 +31,7 @@ public MauiToolbar() titleView.Visibility = UI.Xaml.Visibility.Collapsed; } - internal string? Title + internal static string? Title { get => title.Text; set @@ -45,12 +45,12 @@ internal string? Title } } - internal WImage? TitleIconImage + internal static WImage? TitleIconImage { get => titleIcon; } - internal WImageSource? TitleIconImageSource + internal static WImageSource? TitleIconImageSource { get => titleIcon.Source; set @@ -64,13 +64,13 @@ internal WImageSource? TitleIconImageSource } } - internal UI.Xaml.Thickness TitleViewMargin + internal static UI.Xaml.Thickness TitleViewMargin { get => titleView.Margin; set => titleView.Margin = value; } - internal object? TitleView + internal static object? TitleView { get => titleView.Content; set @@ -95,28 +95,28 @@ internal void SetBarTextColor(WBrush? brush) UpdateMenuBarForeground(); } - internal CommandBar CommandBar => commandBar; + internal static CommandBar CommandBar => commandBar; - internal UI.Xaml.Thickness ContentGridMargin + internal static UI.Xaml.Thickness ContentGridMargin { get => contentGrid.Margin; set => contentGrid.Margin = value; } - internal VerticalAlignment TextBlockBorderVerticalAlignment + internal static VerticalAlignment TextBlockBorderVerticalAlignment { get => textBlockBorder.VerticalAlignment; set => textBlockBorder.VerticalAlignment = value; } - public NavigationViewBackButtonVisible IsBackButtonVisible + public static NavigationViewBackButtonVisible IsBackButtonVisible { get => (NavigationViewBackButtonVisible)GetValue(IsBackButtonVisibleProperty); set => SetValue(IsBackButtonVisibleProperty, value); } - public bool IsBackEnabled + public static bool IsBackEnabled { get => (bool)GetValue(IsBackEnabledProperty); set => SetValue(IsBackEnabledProperty, value); diff --git a/src/Core/src/Platform/Windows/MauiWebView.cs b/src/Core/src/Platform/Windows/MauiWebView.cs index 932db7b69f4d..2e235e10e4b0 100644 --- a/src/Core/src/Platform/Windows/MauiWebView.cs +++ b/src/Core/src/Platform/Windows/MauiWebView.cs @@ -45,7 +45,7 @@ public MauiWebView(WebViewHandler handler) : AppContext.BaseDirectory; public async void LoadHtml(string? html, string? baseUrl) - { + { var mapBaseDirectory = false; if (string.IsNullOrEmpty(baseUrl)) { @@ -56,12 +56,12 @@ public async void LoadHtml(string? html, string? baseUrl) await EnsureCoreWebView2Async(); if (mapBaseDirectory) - { - CoreWebView2.SetVirtualHostNameToFolderMapping( - LocalHostName, - ApplicationPath, - Web.WebView2.Core.CoreWebView2HostResourceAccessKind.Allow); - } + { + CoreWebView2.SetVirtualHostNameToFolderMapping( + LocalHostName, + ApplicationPath, + Web.WebView2.Core.CoreWebView2HostResourceAccessKind.Allow); + } // Insert script to set the base tag var script = GetBaseTagInsertionScript(baseUrl); diff --git a/src/Core/src/Platform/Windows/MauiWinUIWindow.cs b/src/Core/src/Platform/Windows/MauiWinUIWindow.cs index 9b477d5a036f..ad9b3461baf4 100644 --- a/src/Core/src/Platform/Windows/MauiWinUIWindow.cs +++ b/src/Core/src/Platform/Windows/MauiWinUIWindow.cs @@ -28,7 +28,7 @@ public MauiWinUIWindow() { _windowManager = WindowMessageManager.Get(this); _viewSettings = new ViewManagement.UISettings(); - + Activated += OnActivated; Closed += OnClosedPrivate; VisibilityChanged += OnVisibilityChanged; diff --git a/src/Core/src/Platform/Windows/NavigationRootManager.cs b/src/Core/src/Platform/Windows/NavigationRootManager.cs index bd1d4bfa7b65..a3845a1fca20 100644 --- a/src/Core/src/Platform/Windows/NavigationRootManager.cs +++ b/src/Core/src/Platform/Windows/NavigationRootManager.cs @@ -113,12 +113,12 @@ public virtual void Connect(UIElement? platformView) public virtual void Disconnect() { _rootView.OnWindowTitleBarContentSizeChanged -= WindowRootViewOnWindowTitleBarContentSizeChanged; - + if (_platformWindow.TryGetTarget(out var platformWindow)) { platformWindow.Activated -= OnWindowActivated; } - + SetToolbar(null); SetTitleBar(null, null); @@ -141,17 +141,17 @@ internal void SetToolbar(FrameworkElement? toolBar) internal string? WindowTitle { - get => _rootView.WindowTitle; - set => _rootView.WindowTitle = value; + get => WindowRootView.WindowTitle; + set => WindowRootView.WindowTitle = value; } internal void SetTitle(string? title) => - _rootView.WindowTitle = title; + WindowRootView.WindowTitle = title; internal void SetTitleBar(ITitleBar? titlebar, IMauiContext? mauiContext) { if (_platformWindow.TryGetTarget(out var window)) - { + { _rootView.AppWindowId = window.GetAppWindow()?.Id; _rootView.SetTitleBar(titlebar, mauiContext); } @@ -164,11 +164,11 @@ void OnWindowActivated(object sender, WindowActivatedEventArgs e) if (e.WindowActivationState == WindowActivationState.Deactivated) { - _rootView.WindowTitleForeground = inactiveForegroundBrush; + WindowRootView.WindowTitleForeground = inactiveForegroundBrush; } else { - _rootView.WindowTitleForeground = defaultForegroundBrush; + WindowRootView.WindowTitleForeground = defaultForegroundBrush; } } } diff --git a/src/Core/src/Platform/Windows/RootNavigationView.cs b/src/Core/src/Platform/Windows/RootNavigationView.cs index ec2aabb98bb7..cfccefdf63e7 100644 --- a/src/Core/src/Platform/Windows/RootNavigationView.cs +++ b/src/Core/src/Platform/Windows/RootNavigationView.cs @@ -38,13 +38,13 @@ public RootNavigationView() internal new MauiToolbar? Toolbar { - get => base.Toolbar as MauiToolbar; + get => MauiNavigationView.Toolbar as MauiToolbar; set { - if (base.Toolbar == value) + if (MauiNavigationView.Toolbar == value) return; - base.Toolbar = value; + MauiNavigationView.Toolbar = value; if (value != null) { @@ -101,8 +101,8 @@ void UpdateToolbarPlacement() if (Toolbar != null) { - Toolbar.ContentGridMargin = new UI.Xaml.Thickness(0, 0, 4, 0); - Toolbar.TextBlockBorderVerticalAlignment = VerticalAlignment.Center; + MauiToolbar.ContentGridMargin = new UI.Xaml.Thickness(0, 0, 4, 0); + MauiToolbar.TextBlockBorderVerticalAlignment = VerticalAlignment.Center; } } else if (PaneFooter == Toolbar || Header == null) @@ -121,8 +121,8 @@ void UpdateToolbarPlacement() if (Toolbar != null) { - Toolbar.ContentGridMargin = new UI.Xaml.Thickness(0, 0, 0, 0); - Toolbar.TextBlockBorderVerticalAlignment = VerticalAlignment.Top; + MauiToolbar.ContentGridMargin = new UI.Xaml.Thickness(0, 0, 0, 0); + MauiToolbar.TextBlockBorderVerticalAlignment = VerticalAlignment.Top; } } } @@ -256,33 +256,33 @@ void UpdateNavigationAndPaneButtonHolderGridStyles() var buttonHeight = Math.Max(_appBarTitleHeight, DefaultNavigationBackButtonHeight); var buttonRatio = buttonHeight / DefaultNavigationBackButtonHeight; - NavigationBackButtonHeight = buttonHeight; - NavigationBackButtonWidth = DefaultNavigationBackButtonWidth * buttonRatio; + MauiNavigationView.NavigationBackButtonHeight = buttonHeight; + MauiNavigationView.NavigationBackButtonWidth = DefaultNavigationBackButtonWidth * buttonRatio; var paneToggleHeight = Math.Max(_appBarTitleHeight, DefaultPaneToggleButtonHeight); var paneToggleRatio = paneToggleHeight / DefaultPaneToggleButtonHeight; - PaneToggleButtonHeight = paneToggleHeight; - PaneToggleButtonWidth = DefaultPaneToggleButtonWidth * paneToggleRatio; + MauiNavigationView.PaneToggleButtonHeight = paneToggleHeight; + MauiNavigationView.PaneToggleButtonWidth = DefaultPaneToggleButtonWidth * paneToggleRatio; if (PaneDisplayMode == NavigationViewPaneDisplayMode.LeftMinimal || PaneDisplayMode == NavigationViewPaneDisplayMode.Top) { - NavigationViewButtonHolderGridMargin = new WThickness(0, 0, 0, 0); - NavigationViewBackButtonMargin = new WThickness(0, 0, 0, 0); - PaneToggleButtonPadding = new WThickness(); + MauiNavigationView.NavigationViewButtonHolderGridMargin = new WThickness(0, 0, 0, 0); + MauiNavigationView.NavigationViewBackButtonMargin = new WThickness(0, 0, 0, 0); + MauiNavigationView.PaneToggleButtonPadding = new WThickness(); } else if (PaneDisplayMode == NavigationViewPaneDisplayMode.LeftCompact || PaneDisplayMode == NavigationViewPaneDisplayMode.Left || DisplayMode == NavigationViewDisplayMode.Compact) { - NavigationViewButtonHolderGridMargin = new WThickness(0, 0, 0, 0); + MauiNavigationView.NavigationViewButtonHolderGridMargin = new WThickness(0, 0, 0, 0); if (IsPaneToggleButtonVisible) - NavigationViewBackButtonMargin = new WThickness(4, 0, 0, 2); + MauiNavigationView.NavigationViewBackButtonMargin = new WThickness(4, 0, 0, 2); else - NavigationViewBackButtonMargin = new WThickness(4, 0, 0, 0); + MauiNavigationView.NavigationViewBackButtonMargin = new WThickness(4, 0, 0, 0); - PaneToggleButtonPadding = new WThickness(4, 2, 4, 2); + MauiNavigationView.PaneToggleButtonPadding = new WThickness(4, 2, 4, 2); } UpdatePaneContentGridMargin(); @@ -417,7 +417,7 @@ protected override Size ArrangeOverride(Size finalSize) private protected override void UpdateFlyoutCustomContent() { - ReplacePaneMenuItemsWithCustomContent(FlyoutCustomContent as UIElement); + ReplacePaneMenuItemsWithCustomContent(MauiNavigationView.FlyoutCustomContent as UIElement); } } } diff --git a/src/Core/src/Platform/Windows/SliderExtensions.cs b/src/Core/src/Platform/Windows/SliderExtensions.cs index 246d11370c4b..bd4376af3d80 100644 --- a/src/Core/src/Platform/Windows/SliderExtensions.cs +++ b/src/Core/src/Platform/Windows/SliderExtensions.cs @@ -108,7 +108,7 @@ internal static async Task UpdateThumbImageSourceAsync(this MauiSlider nativeSli if (thumbImageSource == null) { - nativeSlider.ThumbImageSource = null; + MauiSlider.ThumbImageSource = null; var thumb = nativeSlider.GetFirstDescendant(); @@ -148,7 +148,7 @@ void OnImageOpened(object sender, RoutedEventArgs e) }; } - nativeSlider.ThumbImageSource = nativeThumbImageSource?.Value; + MauiSlider.ThumbImageSource = nativeThumbImageSource?.Value; } } } diff --git a/src/Core/src/Platform/Windows/TextBoxExtensions.cs b/src/Core/src/Platform/Windows/TextBoxExtensions.cs index 2fb696cf2b57..74c6add110df 100644 --- a/src/Core/src/Platform/Windows/TextBoxExtensions.cs +++ b/src/Core/src/Platform/Windows/TextBoxExtensions.cs @@ -11,14 +11,14 @@ public static class TextBoxExtensions public static void UpdateIsPassword(this TextBox platformControl, IEntry entry) { if (platformControl is MauiPasswordTextBox passwordTextBox) - passwordTextBox.IsPassword = entry.IsPassword; + MauiPasswordTextBox.IsPassword = entry.IsPassword; } public static void UpdateText(this TextBox platformControl, ITextInput textInput) { var newText = textInput.Text; - if (platformControl is MauiPasswordTextBox passwordTextBox && passwordTextBox.Password == newText) + if (platformControl is MauiPasswordTextBox passwordTextBox && MauiPasswordTextBox.Password == newText) return; if (platformControl.Text == newText) diff --git a/src/Core/src/Platform/Windows/ToolbarExtensions.cs b/src/Core/src/Platform/Windows/ToolbarExtensions.cs index b4bd5efb01d8..c915850920f6 100644 --- a/src/Core/src/Platform/Windows/ToolbarExtensions.cs +++ b/src/Core/src/Platform/Windows/ToolbarExtensions.cs @@ -4,7 +4,7 @@ internal static class ToolbarExtensions { public static void UpdateTitle(this MauiToolbar nativeToolbar, IToolbar toolbar) { - nativeToolbar.Title = toolbar.Title; + MauiToolbar.Title = toolbar.Title; } } } diff --git a/src/Core/src/Platform/Windows/WindowRootView.cs b/src/Core/src/Platform/Windows/WindowRootView.cs index 1e12e398b213..e6599b8d8fe4 100644 --- a/src/Core/src/Platform/Windows/WindowRootView.cs +++ b/src/Core/src/Platform/Windows/WindowRootView.cs @@ -80,7 +80,7 @@ internal MenuBar? MenuBar } } - public DataTemplate? AppTitleBarTemplate + public static DataTemplate? AppTitleBarTemplate { get => (DataTemplate?)GetValue(AppTitleBarTemplateProperty); set => SetValue(AppTitleBarTemplateProperty, value); @@ -117,7 +117,7 @@ internal FrameworkElement? AppTitleBar internal void UpdateAppTitleBar(int appTitleBarHeight, bool useCustomAppTitleBar, WThickness margin) { _useCustomAppTitleBar = useCustomAppTitleBar; - WindowTitleBarContentControlMinHeight = appTitleBarHeight; + WindowRootView.WindowTitleBarContentControlMinHeight = appTitleBarHeight; double topMargin = appTitleBarHeight; if (AppTitleBarContentControl != null) @@ -127,14 +127,14 @@ internal void UpdateAppTitleBar(int appTitleBarHeight, bool useCustomAppTitleBar if (useCustomAppTitleBar) { - WindowTitleBarContentControlVisibility = UI.Xaml.Visibility.Visible; + WindowRootView.WindowTitleBarContentControlVisibility = UI.Xaml.Visibility.Visible; } else { - WindowTitleBarContentControlVisibility = UI.Xaml.Visibility.Collapsed; + WindowRootView.WindowTitleBarContentControlVisibility = UI.Xaml.Visibility.Collapsed; } - WindowTitleMargin = margin; + WindowRootView.WindowTitleMargin = margin; UpdateRootNavigationViewMargins(topMargin); this.RefreshThemeResources(); } @@ -275,10 +275,10 @@ void UpdateRootNavigationViewMargins(double margin) void LoadAppTitleBarControls() { - if (WindowTitleBarContent is not null && AppTitleBarContentControl is not null) + if (WindowRootView.WindowTitleBarContent is not null && AppTitleBarContentControl is not null) { AppTitleBarContentControl.ContentTemplateSelector = null; - AppTitleBarContentControl.Content = WindowTitleBarContent; + AppTitleBarContentControl.Content = WindowRootView.WindowTitleBarContent; } else if (AppTitleBar != null && AppFontIcon is null) { @@ -410,18 +410,18 @@ void UpdateAppTitleBarMargins() return; } - WThickness currMargin = WindowTitleBarContainerMargin; + WThickness currMargin = WindowRootView.WindowTitleBarContainerMargin; var leftIndent = buttonHolderGrid.ActualWidth; - WindowTitleBarContainerMargin = new WThickness(leftIndent, currMargin.Top, currMargin.Right, currMargin.Bottom); + WindowRootView.WindowTitleBarContainerMargin = new WThickness(leftIndent, currMargin.Top, currMargin.Right, currMargin.Bottom); // If the AppIcon loads correctly then we set a margin for the text from the image if (_hasTitleBarImage) { - WindowTitleIconVisibility = UI.Xaml.Visibility.Visible; + WindowRootView.WindowTitleIconVisibility = UI.Xaml.Visibility.Visible; } else { - WindowTitleIconVisibility = UI.Xaml.Visibility.Collapsed; + WindowRootView.WindowTitleIconVisibility = UI.Xaml.Visibility.Collapsed; } } @@ -432,9 +432,9 @@ void OnButtonHolderGridSizeChanged(object sender, SizeChangedEventArgs e) internal void SetTitleBar(ITitleBar? titlebar, IMauiContext? mauiContext) { - if (WindowTitleBarContent is not null) + if (WindowRootView.WindowTitleBarContent is not null) { - WindowTitleBarContent.LayoutUpdated -= PlatformView_LayoutUpdated; + global::Microsoft.Maui.Platform.WindowRootView.WindowTitleBarContent.LayoutUpdated -= PlatformView_LayoutUpdated; } if (_titleBar is INotifyPropertyChanged p) @@ -453,17 +453,17 @@ internal void SetTitleBar(ITitleBar? titlebar, IMauiContext? mauiContext) if (handler is not null && handler.PlatformView is not null) { - WindowTitleBarContent = handler.PlatformView; + WindowRootView.WindowTitleBarContent = handler.PlatformView; // This will handle all size changed events when leading/trailing/main content // changes size or is added - WindowTitleBarContent.LayoutUpdated += PlatformView_LayoutUpdated; + global::Microsoft.Maui.Platform.WindowRootView.WindowTitleBarContent.LayoutUpdated += PlatformView_LayoutUpdated; // Override the template selector and content if (AppTitleBarContentControl is not null) { AppTitleBarContentControl.ContentTemplateSelector = null; - AppTitleBarContentControl.Content = WindowTitleBarContent; + AppTitleBarContentControl.Content = WindowRootView.WindowTitleBarContent; } // To handle when leading/trailing/main content is added/removed @@ -547,7 +547,7 @@ static void OnAppTitleBarTemplateChanged(DependencyObject d, DependencyPropertyC typeof(WindowRootView), new PropertyMetadata(null)); - internal String? WindowTitle + internal static String? WindowTitle { get => (String?)GetValue(TitleProperty); set => SetValue(TitleProperty, value); @@ -583,7 +583,7 @@ void UpdateAppTitleBarTransparency() typeof(WindowRootView), new PropertyMetadata(null)); - internal FrameworkElement WindowTitleBarContent + internal static FrameworkElement WindowTitleBarContent { get => (FrameworkElement)GetValue(WindowTitleBarContentProperty); set => SetValue(WindowTitleBarContentProperty, value); @@ -596,7 +596,7 @@ internal FrameworkElement WindowTitleBarContent typeof(WindowRootView), new PropertyMetadata(null)); - internal UI.Xaml.Media.Brush? WindowTitleForeground + internal static UI.Xaml.Media.Brush? WindowTitleForeground { get => (UI.Xaml.Media.Brush?)GetValue(WindowTitleForegroundProperty); set => SetValue(WindowTitleForegroundProperty, value); @@ -609,7 +609,7 @@ internal UI.Xaml.Media.Brush? WindowTitleForeground typeof(WindowRootView), new PropertyMetadata(new WThickness(0))); - internal WThickness WindowTitleBarContainerMargin + internal static WThickness WindowTitleBarContainerMargin { get => (WThickness)GetValue(WindowTitleBarContainerMarginProperty); set => SetValue(WindowTitleBarContainerMarginProperty, value); @@ -622,7 +622,7 @@ internal WThickness WindowTitleBarContainerMargin typeof(WindowRootView), new PropertyMetadata(new WThickness(0))); - internal WThickness WindowTitleMargin + internal static WThickness WindowTitleMargin { get => (WThickness)GetValue(WindowTitleMarginProperty); set => SetValue(WindowTitleMarginProperty, value); @@ -635,7 +635,7 @@ internal WThickness WindowTitleMargin typeof(WindowRootView), new PropertyMetadata(UI.Xaml.Visibility.Collapsed)); - internal UI.Xaml.Visibility WindowTitleIconVisibility + internal static UI.Xaml.Visibility WindowTitleIconVisibility { get => (UI.Xaml.Visibility)GetValue(WindowTitleIconVisibilityProperty); set => SetValue(WindowTitleIconVisibilityProperty, value); @@ -648,7 +648,7 @@ internal UI.Xaml.Visibility WindowTitleIconVisibility typeof(WindowRootView), new PropertyMetadata(UI.Xaml.Visibility.Visible)); - internal UI.Xaml.Visibility WindowTitleBarContentControlVisibility + internal static UI.Xaml.Visibility WindowTitleBarContentControlVisibility { get => (UI.Xaml.Visibility)GetValue(WindowTitleBarContentControlVisibilityProperty); set => SetValue(WindowTitleBarContentControlVisibilityProperty, value); @@ -661,7 +661,7 @@ internal UI.Xaml.Visibility WindowTitleBarContentControlVisibility typeof(WindowRootView), new PropertyMetadata(0d)); - internal double WindowTitleBarContentControlMinHeight + internal static double WindowTitleBarContentControlMinHeight { get => (double)GetValue(WindowTitleBarContentControlMinHeightProperty); set => SetValue(WindowTitleBarContentControlMinHeightProperty, value); diff --git a/src/Core/src/Platform/Windows/WindowRootViewContainer.cs b/src/Core/src/Platform/Windows/WindowRootViewContainer.cs index 8dbdaa293855..ee38f67ec97b 100644 --- a/src/Core/src/Platform/Windows/WindowRootViewContainer.cs +++ b/src/Core/src/Platform/Windows/WindowRootViewContainer.cs @@ -75,7 +75,7 @@ internal void AddOverlay(FrameworkElement overlayView) Children.Add(overlayView); } - internal void RemoveOverlay(FrameworkElement overlayView) + internal static void RemoveOverlay(FrameworkElement overlayView) { Children.Remove(overlayView); } diff --git a/src/Core/tests/DeviceTests/Handlers/DatePicker/DatePickerHandlerTests.Windows.cs b/src/Core/tests/DeviceTests/Handlers/DatePicker/DatePickerHandlerTests.Windows.cs index 3f63aa7c6596..c077a59de555 100644 --- a/src/Core/tests/DeviceTests/Handlers/DatePicker/DatePickerHandlerTests.Windows.cs +++ b/src/Core/tests/DeviceTests/Handlers/DatePicker/DatePickerHandlerTests.Windows.cs @@ -30,7 +30,7 @@ public override async Task ReturnsNonEmptyNativeBoundingBox(int size) var expectedSize = new Size(size, size); AssertWithinTolerance(expectedSize, nativeBoundingBox.Size); } - + [Fact] public override async Task DisconnectHandlerDoesntCrash() { diff --git a/src/Core/tests/DeviceTests/Handlers/Slider/SliderHandlerTests.Windows.cs b/src/Core/tests/DeviceTests/Handlers/Slider/SliderHandlerTests.Windows.cs index 881348cb7ec0..80d0b77ec218 100644 --- a/src/Core/tests/DeviceTests/Handlers/Slider/SliderHandlerTests.Windows.cs +++ b/src/Core/tests/DeviceTests/Handlers/Slider/SliderHandlerTests.Windows.cs @@ -118,7 +118,7 @@ await handler.PlatformView.AttachAndRun(async () => }); } - UI.Xaml.Controls.Slider GetNativeSlider(SliderHandler sliderHandler) => + UI.Xaml.Controls.Slider GetNativeSlider(SliderHandler sliderHandler) => sliderHandler.PlatformView; double GetNativeProgress(SliderHandler sliderHandler) => @@ -163,7 +163,7 @@ async Task ValidateNativeThumbColor(ISlider slider, Color color) return solidThumb.Color.ToColor(); } } - + return null; }); diff --git a/src/Core/tests/DeviceTests/Handlers/Switch/SwitchHandlerTests.Windows.cs b/src/Core/tests/DeviceTests/Handlers/Switch/SwitchHandlerTests.Windows.cs index 47b1241fb7ed..a0900a7a1dbc 100644 --- a/src/Core/tests/DeviceTests/Handlers/Switch/SwitchHandlerTests.Windows.cs +++ b/src/Core/tests/DeviceTests/Handlers/Switch/SwitchHandlerTests.Windows.cs @@ -1,7 +1,7 @@ using System; using System.Threading.Tasks; -using Microsoft.UI.Xaml.Controls; using Microsoft.Maui.DeviceTests.Stubs; +using Microsoft.UI.Xaml.Controls; using Xunit; using Color = Microsoft.Maui.Graphics.Color; diff --git a/src/Essentials/src/Connectivity/Connectivity.uwp.cs b/src/Essentials/src/Connectivity/Connectivity.uwp.cs index fe8f8360d668..b5f0bfae060d 100644 --- a/src/Essentials/src/Connectivity/Connectivity.uwp.cs +++ b/src/Essentials/src/Connectivity/Connectivity.uwp.cs @@ -81,7 +81,7 @@ public IEnumerable ConnectionProfiles { networkInterfaces = NetworkInterface.GetAllNetworkInterfaces(); } - catch (NetworkInformationException ex) + catch (NetworkInformationException ex) { Debug.WriteLine($"Unable to get network interfaces. Error: {ex.Message}"); } diff --git a/src/Essentials/src/Screenshot/Screenshot.uwp.cs b/src/Essentials/src/Screenshot/Screenshot.uwp.cs index 98a197d5b6f1..55e56ba40a8c 100644 --- a/src/Essentials/src/Screenshot/Screenshot.uwp.cs +++ b/src/Essentials/src/Screenshot/Screenshot.uwp.cs @@ -2,12 +2,12 @@ using System.IO; using System.Runtime.InteropServices.WindowsRuntime; using System.Threading.Tasks; -using Windows.Graphics.Imaging; -using Windows.Storage.Streams; using Microsoft.Maui.ApplicationModel; using Microsoft.UI.Xaml; -using Microsoft.UI.Xaml.Media.Imaging; using Microsoft.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Media.Imaging; +using Windows.Graphics.Imaging; +using Windows.Storage.Streams; namespace Microsoft.Maui.Media { diff --git a/src/TestUtils/src/DeviceTests/AssertionExtensions.Windows.cs b/src/TestUtils/src/DeviceTests/AssertionExtensions.Windows.cs index a7c83e7f9be8..3732f1a2f43c 100644 --- a/src/TestUtils/src/DeviceTests/AssertionExtensions.Windows.cs +++ b/src/TestUtils/src/DeviceTests/AssertionExtensions.Windows.cs @@ -10,10 +10,10 @@ using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Automation; using Microsoft.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Input; using Microsoft.UI.Xaml.Media.Imaging; using Windows.Graphics.DirectX; using Windows.Storage.Streams; -using Microsoft.UI.Xaml.Input; using Xunit; using Xunit.Sdk; using WColor = Windows.UI.Color; diff --git a/src/TestUtils/src/Microsoft.Maui.IntegrationTests/MacTemplateTest.cs b/src/TestUtils/src/Microsoft.Maui.IntegrationTests/MacTemplateTest.cs index 18a761e91589..a5625b047538 100644 --- a/src/TestUtils/src/Microsoft.Maui.IntegrationTests/MacTemplateTest.cs +++ b/src/TestUtils/src/Microsoft.Maui.IntegrationTests/MacTemplateTest.cs @@ -109,10 +109,10 @@ public void CheckPrivacyManifestForiOS(string id, string config, string framewor List buildWithCodeSignProps = new List(BuildProps); - if(!sign && config == "Release") + if (!sign && config == "Release") { // Skipping Release build without code signing." - buildWithCodeSignProps.Add("EnableCodeSigning=false"); + buildWithCodeSignProps.Add("EnableCodeSigning=false"); buildWithCodeSignProps.Add("_RequireCodeSigning=false"); } else if (sign) diff --git a/src/TestUtils/src/Microsoft.Maui.IntegrationTests/SimpleTemplateTest.cs b/src/TestUtils/src/Microsoft.Maui.IntegrationTests/SimpleTemplateTest.cs index e9e48324a146..5a7dee4a7cbb 100644 --- a/src/TestUtils/src/Microsoft.Maui.IntegrationTests/SimpleTemplateTest.cs +++ b/src/TestUtils/src/Microsoft.Maui.IntegrationTests/SimpleTemplateTest.cs @@ -7,7 +7,7 @@ public class SimpleTemplateTest : BaseTemplateTests { [Test] // Parameters: short name, target framework, build config, use pack target, additionalDotNetNewParams, additionalDotNetBuildParams - [TestCase("maui", DotNetPrevious, "Debug", false, "","")] + [TestCase("maui", DotNetPrevious, "Debug", false, "", "")] [TestCase("maui", DotNetPrevious, "Release", false, "", "")] [TestCase("maui", DotNetCurrent, "Debug", false, "", "")] [TestCase("maui", DotNetCurrent, "Release", false, "", "TrimMode=partial")] @@ -17,13 +17,13 @@ public class SimpleTemplateTest : BaseTemplateTests [TestCase("maui-blazor", DotNetPrevious, "Release", false, "", "")] [TestCase("maui-blazor", DotNetCurrent, "Debug", false, "", "")] [TestCase("maui-blazor", DotNetCurrent, "Release", false, "", "TrimMode=partial")] - [TestCase("maui-blazor", DotNetCurrent, "Debug", false, "--Empty","")] - [TestCase("maui-blazor", DotNetCurrent, "Release", false, "--Empty","TrimMode=partial")] + [TestCase("maui-blazor", DotNetCurrent, "Debug", false, "--Empty", "")] + [TestCase("maui-blazor", DotNetCurrent, "Release", false, "--Empty", "TrimMode=partial")] [TestCase("mauilib", DotNetPrevious, "Debug", true, "", "")] - [TestCase("mauilib", DotNetPrevious, "Release", true, "","")] + [TestCase("mauilib", DotNetPrevious, "Release", true, "", "")] [TestCase("mauilib", DotNetCurrent, "Debug", true, "", "")] [TestCase("mauilib", DotNetCurrent, "Release", true, "", "TrimMode=partial")] - public void Build(string id, string framework, string config, bool shouldPack, string additionalDotNetNewParams, string additionalDotNetBuildParams) + public void Build(string id, string framework, string config, bool shouldPack, string additionalDotNetNewParams, string additionalDotNetBuildParams) { var projectDir = TestDirectory; var projectFile = Path.Combine(projectDir, $"{Path.GetFileName(projectDir)}.csproj"); @@ -49,7 +49,7 @@ public void Build(string id, string framework, string config, bool shouldPack, s "XC0103", // https://github.com/CommunityToolkit/Maui/issues/2205 }; } - + var buildProps = BuildProps; if (additionalDotNetBuildParams is not "" and not null) @@ -113,9 +113,9 @@ public void BuildsWithSpecialCharacters(string id, string projectName, string ex [TestCase("maui", DotNetPrevious, "Release", false, "")] [TestCase("maui", DotNetCurrent, "Debug", false, "")] [TestCase("maui", DotNetCurrent, "Release", false, "TrimMode=partial")] - [TestCase("maui-blazor", DotNetPrevious, "Debug", false, "")] - [TestCase("maui-blazor", DotNetPrevious, "Release", false, "")] - [TestCase("maui-blazor", DotNetCurrent, "Debug", false, "")] + [TestCase("maui-blazor", DotNetPrevious, "Debug", false, "")] + [TestCase("maui-blazor", DotNetPrevious, "Release", false, "")] + [TestCase("maui-blazor", DotNetCurrent, "Debug", false, "")] [TestCase("maui-blazor", DotNetCurrent, "Release", false, "TrimMode=partial")] [TestCase("mauilib", DotNetPrevious, "Debug", true, "")] [TestCase("mauilib", DotNetPrevious, "Release", true, "")] @@ -283,7 +283,7 @@ public void BuildWithoutPackageReference(string id, string framework, string con [TestCase("maui", "Release", "2.0", "2", "TrimMode=partial")] [TestCase("maui", "Release", "0.3", "3", "TrimMode=partial")] [TestCase("maui-blazor", "Debug", "2.0", "2", "")] - [TestCase("maui-blazor", "Release", "2.0", "2", "TrimMode=partial")] + [TestCase("maui-blazor", "Release", "2.0", "2", "TrimMode=partial")] [TestCase("maui-blazor", "Release", "0.3", "3", "TrimMode=partial")] public void BuildWithDifferentVersionNumber(string id, string config, string display, string version, string additionalDotNetBuildParams) { @@ -307,7 +307,7 @@ public void BuildWithDifferentVersionNumber(string id, string config, string dis { additionalDotNetBuildParams.Split(" ").ToList().ForEach(p => buildProps.Add(p)); } - + Assert.IsTrue(DotnetInternal.Build(projectFile, config, properties: buildProps, msbuildWarningsAsErrors: true), $"Project {Path.GetFileName(projectFile)} failed to build. Check test output/attachments for errors."); }