Skip to content
Permalink
main
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
using Microsoft.Extensions.Logging;
using MauiApp1.ViewModel;
using MauiApp1.Page;
using MauiApp1.Services;
using MauiApp1.Interface;
using MauiApp1.Models;
using CommunityToolkit.Maui;
using Supabase;
namespace MauiApp1
{
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<OrganisationsListingViewModel>();
builder.Services.AddTransient<AddOrganisationViewModel>();
builder.Services.AddTransient<UpdateOrganisationViewModel>();
builder.Services.AddTransient<LoginViewModel>();
builder.Services.AddTransient<SignupViewModel>();
// Add Views
builder.Services.AddSingleton<OrganisationsListingPage>();
builder.Services.AddTransient<AddOrganisationPage>();
builder.Services.AddTransient<UpdateOrganisationPage>();
builder.Services.AddTransient<ProfilePage>();
builder.Services.AddTransient<LoginPage>();
builder.Services.AddTransient<SignupPage>();
// Add Data Service
builder.Services.AddSingleton<IDataService, DataService>();
builder.Services.AddSingleton<IUserService, UserService>();
builder.Services.AddTransient<MainPage>();
builder.Services.AddTransient<MainViewModel>();
#if DEBUG
builder.Logging.AddDebug();
#endif
AddCharityServices(builder.Services);
builder.Services.AddTransient<UserService>();
builder.Services.AddTransient<LoadingPage>();
// builder.Services.AddTransient<LoginPage>();
builder.Services.AddTransient<SignupPage>();
return builder.Build();
}
private static IServiceCollection AddCharityServices(IServiceCollection services)
{
services.AddSingleton<CharityService>();
services.AddTransient<DetailPage>();
services.AddTransient<DetailViewModel>();
services.AddTransient<Charity1Page>();
services.AddTransient<Charity1ViewModel>();
services.AddTransient<BasketPage>();
services.AddSingleton<BasketViewModel>();
return services;
}
}
}