-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
25 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,32 @@ | ||
using System; | ||
using Avalonia.Maui.Controls; | ||
using Avalonia.Maui.Handlers; | ||
using Microsoft.Maui.Hosting; | ||
|
||
namespace Avalonia.Maui | ||
{ | ||
public static class MauiAppHostBuilderExtensions | ||
{ | ||
public static MauiAppBuilder UseAvalonia<TApp>(this MauiAppBuilder builder, Action<AppBuilder> customizeBuilder) where TApp : Application, new() | ||
public static MauiAppBuilder UseAvalonia<TApp>(this MauiAppBuilder builder, Action<AppBuilder>? customizeBuilder = null) where TApp : Application, new() | ||
{ | ||
var avaloniaBuilder = AppBuilder.Configure<TApp>(); | ||
customizeBuilder(avaloniaBuilder); | ||
#if ANDROID | ||
avaloniaBuilder.UseAndroid(); | ||
#elif IOS | ||
avaloniaBuilder.UseiOS(); | ||
#endif | ||
|
||
customizeBuilder?.Invoke(avaloniaBuilder); | ||
|
||
avaloniaBuilder.SetupWithoutStarting(); | ||
return builder; | ||
|
||
return builder | ||
.ConfigureMauiHandlers(handlers => | ||
{ | ||
#if ANDROID || IOS | ||
handlers.AddHandler(typeof(AvaloniaView), typeof(AvaloniaViewHandler)); | ||
#endif | ||
});; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters