-
-
Save ZadokJoshua/0da084463d7f7a21aaa079de457692d7 to your computer and use it in GitHub Desktop.
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 BooksTracker.Models; | |
using BooksTracker.Services; | |
using BooksTracker.ViewModels; | |
using BooksTracker.Views; | |
using CommunityToolkit.Maui; | |
using Microsoft.Extensions.Logging; | |
using Supabase; | |
namespace BooksTracker; | |
public static class MauiProgram | |
{ | |
public static MauiApp CreateMauiApp() | |
{ | |
var builder = MauiApp.CreateBuilder(); | |
builder.UseMauiApp<App>() | |
.UseMauiCommunityToolkit() | |
.ConfigureFonts(fonts => | |
{ | |
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular"); | |
fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold"); | |
}); | |
// Configure Supabase | |
var url = AppConfig.SUPABASE_URL; | |
var key = AppConfig.SUPABASE_KEY; | |
builder.Services.AddSingleton(provider => new Supabase.Client(url, key)); | |
// Add ViewModels | |
builder.Services.AddSingleton<BooksListingViewModel>(); | |
builder.Services.AddTransient<AddBookViewModel>(); | |
builder.Services.AddTransient<UpdateBookViewModel>(); | |
// Add Views | |
builder.Services.AddSingleton<BooksListingPage>(); | |
builder.Services.AddTransient<AddBookPage>(); | |
builder.Services.AddTransient<UpdateBookPage>(); | |
// Add Data Service | |
builder.Services.AddSingleton<IDataService, DataService>(); | |
#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