diff --git a/src/Avalonia.Controls/AppBuilder.cs b/src/Avalonia.Controls/AppBuilder.cs
index df50a105be..86ba8c3786 100644
--- a/src/Avalonia.Controls/AppBuilder.cs
+++ b/src/Avalonia.Controls/AppBuilder.cs
@@ -1,27 +1,51 @@
// Copyright (c) The Avalonia Project. All rights reserved.
// Licensed under the MIT license. See licence.md file in the project root for full license information.
-using Avalonia.Input;
using System;
namespace Avalonia.Controls
{
+ ///
+ /// Initializes up platform-specific services for an .
+ ///
public class AppBuilder
{
+ ///
+ /// Gets or sets the instance being initialized.
+ ///
public Application Instance { get; set; }
+ ///
+ /// Gets or sets a method to call the initialize the windowing subsystem.
+ ///
public Action WindowingSubsystem { get; set; }
+ ///
+ /// Gets or sets a method to call the initialize the windowing subsystem.
+ ///
public Action RenderingSubsystem { get; set; }
+ ///
+ /// Gets or sets a method to call before is called on the
+ /// .
+ ///
public Action BeforeStartCallback { get; set; }
+ ///
+ /// Begin configuring an .
+ ///
+ /// The subclass of to configure.
+ /// An instance.
public static AppBuilder Configure()
where TApp : Application, new()
{
return Configure(new TApp());
}
+ ///
+ /// Begin configuring an .
+ ///
+ /// An instance.
public static AppBuilder Configure(Application app)
{
AvaloniaLocator.CurrentMutable.BindToSelf(app);
@@ -32,12 +56,22 @@ namespace Avalonia.Controls
};
}
+ ///
+ /// Registers a callback to call before is called on the
+ /// .
+ ///
+ /// The callback.
+ /// An instance.
public AppBuilder BeforeStarting(Action callback)
{
BeforeStartCallback = callback;
return this;
}
+ ///
+ /// Starts the application with an instance of .
+ ///
+ /// The window type.
public void Start()
where TMainWindow : Window, new()
{
@@ -49,25 +83,42 @@ namespace Avalonia.Controls
Instance.Run(window);
}
+ ///
+ /// Sets up the platform-specific services for the application, but does not run it.
+ ///
+ ///
public AppBuilder SetupWithoutStarting()
{
Setup();
return this;
}
+ ///
+ /// Specifies a windowing subsystem to use.
+ ///
+ /// The method to call to initialize the windowing subsystem.
+ /// An instance.
public AppBuilder WithWindowingSubsystem(Action initializer)
{
WindowingSubsystem = initializer;
return this;
}
+ ///
+ /// Specifies a rendering subsystem to use.
+ ///
+ /// The method to call to initialize the rendering subsystem.
+ /// An instance.
public AppBuilder WithRenderingSubsystem(Action initializer)
{
RenderingSubsystem = initializer;
return this;
}
- public void Setup()
+ ///
+ /// Sets up the platform-speciic services for the .
+ ///
+ private void Setup()
{
if (Instance == null)
{
@@ -83,6 +134,7 @@ namespace Avalonia.Controls
{
throw new InvalidOperationException("No rendering system configured.");
}
+
Instance.RegisterServices();
WindowingSubsystem();
RenderingSubsystem();
diff --git a/src/Avalonia.DesignerSupport/DesignerAssist.cs b/src/Avalonia.DesignerSupport/DesignerAssist.cs
index d0b50802b5..64aa9106c7 100644
--- a/src/Avalonia.DesignerSupport/DesignerAssist.cs
+++ b/src/Avalonia.DesignerSupport/DesignerAssist.cs
@@ -62,7 +62,7 @@ namespace Avalonia.DesignerSupport
AppBuilder.Configure(app == null ? new DesignerApp() : (Application) Activator.CreateInstance(app.AsType()))
.WithWindowingSubsystem(Application.InitializeWin32Subsystem)
.WithRenderingSubsystem(() => { })
- .Setup();
+ .SetupWithoutStarting();
}
private static void SetScalingFactor(double factor)