Skip to content

Commit

Permalink
Merge pull request #589 from AndreasReitberger/588-switch-to-createwi…
Browse files Browse the repository at this point in the history
…ndowiactivationstate-activationstate

Switched to `CreateWindow(IActivationState? activationState)`
  • Loading branch information
AndreasReitberger authored Dec 9, 2024
2 parents ad0d671 + abb90d5 commit a507089
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 a507089

Please sign in to comment.