Last active
February 18, 2024 05:53
-
-
Save beginnerapps/3967ce1cd13570de10f3d396097808d3 to your computer and use it in GitHub Desktop.
MauiProgram Setup
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
using Microsoft.Extensions.Logging; | |
using Microsoft.Maui.Controls.Hosting; | |
using Microsoft.Maui.Hosting; | |
namespace BingoMania; | |
public static class MauiProgram | |
{ | |
//1. Passing MauiAppBuilder builder as an argument to be supplied from Platform Specific Project so that | |
// We can register Platform Specific Services to our IOC container | |
public static MauiApp CreateMauiApp(MauiAppBuilder builder) | |
{ | |
builder | |
.UseMauiApp<App>() | |
.RegisterServices() //2. Extension to Register Shared Services | |
.RegisterViewModels() //3. Extension to Register all ViewModels | |
.RegisterViews() //4. Extension to Register all Views/Pages | |
.RegisterStartupSequenceItems() //5. Extension to register our application Startup Process | |
.ConfigureFonts(fonts => | |
{ | |
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular"); | |
fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold"); | |
}); | |
#if DEBUG | |
builder.Logging.AddDebug(); | |
#endif | |
return builder.Build(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment