From 67e6ba4354eba81a49cc8efa320d5854374fb565 Mon Sep 17 00:00:00 2001 From: Benedikt Stebner Date: Tue, 28 Feb 2023 09:27:29 +0100 Subject: [PATCH] Add AppBuilder extension --- src/Avalonia.Controls/AppBuilder.cs | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/src/Avalonia.Controls/AppBuilder.cs b/src/Avalonia.Controls/AppBuilder.cs index 9e1222de6d..7e9fa1cab7 100644 --- a/src/Avalonia.Controls/AppBuilder.cs +++ b/src/Avalonia.Controls/AppBuilder.cs @@ -6,7 +6,6 @@ using Avalonia.Controls.ApplicationLifetimes; using Avalonia.Platform; using Avalonia.Media.Fonts; using Avalonia.Media; -using System.Xml.Linq; namespace Avalonia { @@ -19,7 +18,7 @@ namespace Avalonia private Action? _optionsInitializers; private Func? _appFactory; private IApplicationLifetime? _lifetime; - + /// /// Gets or sets the instance. /// @@ -34,12 +33,12 @@ namespace Avalonia /// Gets the instance being initialized. /// public Application? Instance { get; private set; } - + /// /// Gets the type of the Instance (even if it's not created yet) /// public Type? ApplicationType { get; private set; } - + /// /// Gets or sets a method to call the initialize the windowing subsystem. /// @@ -67,7 +66,7 @@ namespace Avalonia public Action AfterPlatformServicesSetupCallback { get; private set; } = builder => { }; - + /// /// Initializes a new instance of the class. /// @@ -76,7 +75,7 @@ namespace Avalonia builder => StandardRuntimePlatformServices.Register(builder.ApplicationType?.Assembly)) { } - + /// /// Initializes a new instance of the class. /// @@ -126,8 +125,8 @@ namespace Avalonia AfterSetupCallback = (Action)Delegate.Combine(AfterSetupCallback, callback); return Self; } - - + + public AppBuilder AfterPlatformServicesSetup(Action callback) { AfterPlatformServicesSetupCallback = (Action)Delegate.Combine(AfterPlatformServicesSetupCallback, callback); @@ -135,7 +134,7 @@ namespace Avalonia } public delegate void AppMainDelegate(Application app, string[] args); - + public void Start(AppMainDelegate main, string[] args) { Setup(); @@ -163,7 +162,7 @@ namespace Avalonia Setup(); return Self; } - + /// /// Specifies a windowing subsystem to use. /// @@ -198,7 +197,7 @@ namespace Avalonia _optionsInitializers += () => { AvaloniaLocator.CurrentMutable.Bind().ToConstant(options); }; return Self; } - + /// /// Configures platform-specific options /// @@ -207,7 +206,7 @@ namespace Avalonia _optionsInitializers += () => { AvaloniaLocator.CurrentMutable.Bind().ToFunc(options); }; return Self; } - + /// /// Registers a custom font collection with the font manager. ///