Skip to content

Commit

Permalink
Switched to CreateWindow(IActivationState? activationState)
Browse files Browse the repository at this point in the history
Fixed #588
  • Loading branch information
AndreasReitberger committed Nov 21, 2024
1 parent 8865b9d commit abb90d5
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/SharedMauiXamlStylesLibrary.SampleApp/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,22 @@ namespace SharedMauiXamlStylesLibrary.SampleApp
{
public partial class App : Application
{
public static IServiceProvider? ServiceProvider;

public App(IServiceProvider serviceProvider)
{
ServiceProvider = serviceProvider;
SecretAppSetting secrets = SecretAppSettingReader.ReadSection<SecretAppSetting>("ExampleApp");
if (secrets is not null)
{
SyncfusionLicenseProvider.RegisterLicense(secrets.SyncfusionApiKey);
}
InitializeComponent();

// Workaroung: https://github.com/dotnet/maui/issues/11485#issuecomment-1416689085
MainPage = serviceProvider.GetRequiredService<AppShell>();
}
protected override Window CreateWindow(IActivationState? activationState)
{
AppShell? page = ServiceProvider?.GetRequiredService<AppShell>();
return new Window(page ?? new AppShell());
}
}
}

0 comments on commit abb90d5

Please sign in to comment.