Skip to content
Permalink
master
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 dotNET_NoWASTE.Data;
using dotNET_NoWASTE.ViewModels;
using dotNET_NoWASTE.Views;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Maui.Hosting;
using SQLite;
namespace dotNET_NoWASTE;
public static class MauiProgram
{
public static MauiApp CreateMauiApp()
{
var builder = MauiApp.CreateBuilder();
builder
.UseMauiApp<App>()
.ConfigureFonts(fonts =>
{
fonts.AddFont("Roboto-Medium.ttf", "Roboto-Medium");
fonts.AddFont("Roboto-Black.ttf", "Roboto-Black");
});
#if DEBUG
builder.Logging.AddDebug();
#endif
// Data
string dbPath = Path.Combine(FileSystem.AppDataDirectory, "Nowastedatabase.db3");
builder.Services.AddSingleton<FoodRepository>(s => ActivatorUtilities.CreateInstance<FoodRepository>(s, dbPath));
// Services
// Views
builder.Services.AddTransient<LoginPageView>();
builder.Services.AddTransient<SignUpPageView>();
builder.Services.AddTransient<AddFoodPageView>();
builder.Services.AddSingleton<FoodPageView>();
builder.Services.AddSingleton<ContactPageView>();
// ViewModels
builder.Services.AddTransient<LoginPageViewModel>();
builder.Services.AddTransient<SignUpPageViewModel>();
builder.Services.AddTransient<AddFoodPageViewModel>();
builder.Services.AddSingleton<FoodPageViewModel>();
builder.Services.AddSingleton<ContactPageViewModel>();
return builder.Build();
}
}