Alinear BD local con esquema de produccion, login offline y publicacion portable
- Modelos renombrados para coincidir con columnas de MariaDB (ApPaterno/ApMaterno, HoraSalida, FechaFin, IdAsistenciaProfesor) - Agregado campo IdAlumno a DetalleContrato - Seed data con IDs reales de produccion (16451, 16493, profesor 15668563-1) - Login offline: solo valida RUT contra BD local, sin contraseña - ConnectivityService: checkea internet al inicio, bloquea si hay conexion - ViewLocator corregido: busca tipos en todos los ensamblados - Todos los ViewModels heredan de ViewModelBase - Publicacion self-contained para win-x64, linux-x64, osx-x64, osx-arm64 - Agregado .gitignore, removidos bin/obj/publish del tracking
This commit is contained in:
1 parent
9068122b6b
commit
fb275508ee
19 files changed
+196
-77
No files matched your search
@@ -8,26 +8,51 @@ using System.Collections.ObjectModel;
|
||||
|
||||
namespace Asistencia.ViewModels;
|
||||
|
||||
public partial class MainWindowViewModel : ObservableObject
|
||||
public partial class MainWindowViewModel : ViewModelBase
|
||||
{
|
||||
private readonly AuthService _authService;
|
||||
private readonly AsistenciaService _asistenciaService;
|
||||
private readonly ConnectivityService _connectivityService;
|
||||
private object? _currentView;
|
||||
|
||||
[ObservableProperty]
|
||||
private string _currentViewTitle = "Login";
|
||||
|
||||
[ObservableProperty]
|
||||
private bool _conexionDisponible;
|
||||
|
||||
[ObservableProperty]
|
||||
private string _mensajeConexion = string.Empty;
|
||||
|
||||
public object? CurrentView
|
||||
{
|
||||
get => _currentView;
|
||||
set => SetProperty(ref _currentView, value);
|
||||
}
|
||||
|
||||
public MainWindowViewModel(AuthService authService, AsistenciaService asistenciaService)
|
||||
public MainWindowViewModel(AuthService authService, AsistenciaService asistenciaService, ConnectivityService connectivityService)
|
||||
{
|
||||
_authService = authService;
|
||||
_asistenciaService = asistenciaService;
|
||||
CurrentView = new LoginViewModel(authService, this);
|
||||
_connectivityService = connectivityService;
|
||||
_ = VerificarConexionAsync();
|
||||
}
|
||||
|
||||
private async Task VerificarConexionAsync()
|
||||
{
|
||||
var hayInternet = await _connectivityService.HayConexionAsync();
|
||||
ConexionDisponible = hayInternet;
|
||||
|
||||
if (hayInternet)
|
||||
{
|
||||
MensajeConexion = "Aplicación no disponible con conexión a internet. Desconéctese para usar el sistema.";
|
||||
CurrentView = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
MensajeConexion = "Modo offline — Using local database";
|
||||
CurrentView = new LoginViewModel(_authService, this);
|
||||
}
|
||||
}
|
||||
|
||||
public void NavigateToLogin()
|
||||
|
||||
Reference in new issue
Block a user