Fixed WinForms designer issue

This commit is contained in:
Thorsten Sommer 2022-07-11 17:58:37 +02:00
parent 3dfaccc99f
commit f1fc782506
Signed by: tsommer
GPG Key ID: 371BBA77A02C0108
2 changed files with 4 additions and 2 deletions

View File

@ -13,7 +13,9 @@ public partial class SectionTree : UserControl
public SectionTree()
{
this.InitializeComponent();
if(this.DesignMode)
// Check if we are in the designer:
if(Program.SERVICE_PROVIDER is null)
return;
// Get the DI context from the main form:

View File

@ -8,7 +8,7 @@ namespace UI_WinForms;
internal static class Program
{
internal const string VERSION = "v0.1.0";
internal static IServiceProvider SERVICE_PROVIDER = null!;
internal static IServiceProvider? SERVICE_PROVIDER;
[STAThread]
private static void Main()