-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.xaml.cs
More file actions
22 lines (19 loc) · 740 Bytes
/
Copy pathApp.xaml.cs
File metadata and controls
22 lines (19 loc) · 740 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
namespace AppVidaMinisterio
{
public partial class App : Application
{
public App()
{
InitializeComponent();
}
protected override Window CreateWindow(IActivationState? activationState)
{
if (MauiProgram.MauiAppInstance?.Services is not IServiceProvider serviceProvider)
throw new InvalidOperationException("Servicios no inicializados");
// Si usara new AppShell() directamente, no se inyectarían
// automáticamente sus dependencias (como MainViewModel), lo que rompería el flujo de DI.
var appShell = serviceProvider.GetRequiredService<AppShell>();
return new Window(appShell);
}
}
}