Prima configurazione e struttura
This commit is contained in:
1 parent
1a949051ca
commit
ecafebae7f
66 files changed
+1153
-645
No files matched your search
@@ -0,0 +1,35 @@
|
||||
using Microsoft.AspNetCore.Components.Authorization;
|
||||
using SteUp.Maui.Core.Services;
|
||||
using SteUp.Maui.Core.System.Network;
|
||||
using SteUp.Shared.Core.Interface;
|
||||
using SteUp.Shared.Core.Interface.IntegryApi;
|
||||
using SteUp.Shared.Core.Interface.System.Network;
|
||||
using SteUp.Shared.Core.Services;
|
||||
|
||||
namespace SteUp.Maui.Core;
|
||||
|
||||
public static class CoreModule
|
||||
{
|
||||
public static void RegisterAppServices(this MauiAppBuilder builder)
|
||||
{
|
||||
builder.Services.AddSingleton<IFormFactor, FormFactor>();
|
||||
}
|
||||
|
||||
public static void RegisterIntegryServices(this MauiAppBuilder builder)
|
||||
{
|
||||
builder.Services.AddScoped<IIntegryApiService, IntegryApiService>();
|
||||
}
|
||||
|
||||
public static void RegisterSystemService(this MauiAppBuilder builder)
|
||||
{
|
||||
builder.Services.AddSingleton<INetworkService, NetworkService>();
|
||||
}
|
||||
|
||||
public static void AddAuthorizationCore(this MauiAppBuilder builder)
|
||||
{
|
||||
builder.Services.AddAuthorizationCore();
|
||||
builder.Services.AddScoped<AppAuthenticationStateProvider>();
|
||||
builder.Services.AddScoped<AuthenticationStateProvider>(provider =>
|
||||
provider.GetRequiredService<AppAuthenticationStateProvider>());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using SteUp.Shared.Core.Interface;
|
||||
|
||||
namespace SteUp.Maui.Core.Services;
|
||||
|
||||
public class FormFactor : IFormFactor
|
||||
{
|
||||
public string GetFormFactor()
|
||||
{
|
||||
return DeviceInfo.Idiom.ToString();
|
||||
}
|
||||
public string GetPlatform()
|
||||
{
|
||||
return DeviceInfo.Platform.ToString() + " - " + DeviceInfo.VersionString;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using SteUp.Shared.Core.Interface.System.Network;
|
||||
|
||||
namespace SteUp.Maui.Core.System.Network;
|
||||
|
||||
public class NetworkService : INetworkService
|
||||
{
|
||||
public bool ConnectionAvailable { get; set; }
|
||||
|
||||
public bool IsNetworkAvailable() =>
|
||||
Connectivity.Current.NetworkAccess == NetworkAccess.Internet;
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user