Files
SteUP_Dotnet/SteUp.Maui/Core/CoreModule.cs
T
MarcoE 2e3a318132 Togli il + dalla barra e porta le azioni nella testata
Il "+" stava incastrato a destra nella barra di navigazione, che per il resto
contiene destinazioni. Cambiava significato da una schermata all'altra senza
mai dichiararlo, e su Ispezioni apriva un menu per far scegliere fra una cosa
sola. Il documento di stile esclude esplicitamente il FAB di serie, e la barra
torna a contenere solo le due destinazioni.

Su Ispezioni l'azione e' un bottone con il suo nome nella testata, e porta
dritta alla scelta del punto vendita senza passaggi intermedi. Lo stato vuoto
offre lo stesso comando invece di spiegare dove trovarlo.

Su Ispezione le azioni sono tre e con pesi diversi: restano in un bottom sheet,
aperto dalla testata. Eliminare un'ispezione ora chiede conferma — prima un
tocco cancellava ispezione e schede senza appello.

Le azioni vivono nella pagina che le esegue, quindi i messaggi che le
rimbalzavano dalla barra (NewSchedaService, CompleteInspectionService) non
hanno piu' mittente e se ne vanno.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-17 12:47:06 +02:00

92 lines
3.5 KiB
C#

using CommunityToolkit.Mvvm.Messaging;
using Microsoft.AspNetCore.Components.Authorization;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using SteUp.Data.LocalDb;
using SteUp.Data.LocalDb.EntityServices;
using SteUp.Maui.Core.Logger;
using SteUp.Maui.Core.Services;
using SteUp.Maui.Core.System;
using SteUp.Maui.Core.System.Network;
using SteUp.Shared.Core.BarcodeReader;
using SteUp.Shared.Core.BarcodeReader.Contracts;
using SteUp.Shared.Core.Data;
using SteUp.Shared.Core.Data.Contracts;
using SteUp.Shared.Core.Interface;
using SteUp.Shared.Core.Interface.IntegryApi;
using SteUp.Shared.Core.Interface.LocalDb;
using SteUp.Shared.Core.Interface.System;
using SteUp.Shared.Core.Interface.System.Network;
using SteUp.Shared.Core.Messages.Scanner;
using SteUp.Shared.Core.Messages.System;
using SteUp.Shared.Core.Services;
namespace SteUp.Maui.Core;
public static class CoreModule
{
extension(MauiAppBuilder builder)
{
public void RegisterAppServices()
{
builder.Services.AddSingleton<IFormFactor, FormFactor>();
builder.Services.AddSingleton<IGenericSystemService, GenericSystemService>();
builder.Services.AddScoped<ISteupDataService, SteupDataService>();
builder.Services.AddSingleton<IBarcodeManager, BarcodeManager>();
}
public void RegisterIntegryServices()
{
builder.Services.AddScoped<IIntegryApiService, IntegryApiService>();
builder.Services.AddScoped<IIntegrySteupService, IntegrySteupService>();
}
public void RegisterSystemService()
{
builder.Services.AddSingleton<INetworkService, NetworkService>();
builder.Services.AddSingleton<IAttachedService, AttachedService>();
builder.Services.AddSingleton<IFileManager, FileManager>();
builder.Services.AddSingleton<IBarcodeReaderService, HoneywellScannerService>();
}
public void AddAuthorizationCore()
{
builder.Services.AddAuthorizationCore();
builder.Services.AddScoped<AppAuthenticationStateProvider>();
builder.Services.AddScoped<AuthenticationStateProvider>(provider =>
provider.GetRequiredService<AppAuthenticationStateProvider>());
}
public void RegisterMessageServices()
{
builder.Services.AddSingleton<IMessenger, WeakReferenceMessenger>();
builder.Services.AddSingleton<OnScannerService>();
builder.Services.AddSingleton<BackButtonService>();
}
public void RegisterDbServices()
{
builder.Services.AddSingleton<IDbPathProvider, DbPathProvider>();
builder.Services.AddDbContext<AppDbContext>((sp, options) =>
{
var dbPath = sp.GetRequiredService<IDbPathProvider>().GetDbPath();
options.UseSqlite($"Filename={dbPath}");
});
builder.Services.AddSingleton<IDbInitializer, DbInitializer>();
builder.Services.AddSingleton<IIspezioniService, IspezioniService>();
}
public void RegisterLoggerServices()
{
var logPath = Path.Combine(FileSystem.AppDataDirectory, "logs");
const string logFilePrefix = "SteUp-log";
builder.Services.AddLogging(loggingBuilder =>
{
loggingBuilder.AddProvider(new FileLoggerProvider(logPath, logFilePrefix));
loggingBuilder.SetMinimumLevel(LogLevel.Information);
});
}
}
}