From f1fc7825062fab80097e9aa1316757797934f92a Mon Sep 17 00:00:00 2001 From: Thorsten Sommer Date: Mon, 11 Jul 2022 17:58:37 +0200 Subject: [PATCH] Fixed WinForms designer issue --- I18N Commander/UI WinForms/Components/SectionTree.cs | 4 +++- I18N Commander/UI WinForms/Program.cs | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/I18N Commander/UI WinForms/Components/SectionTree.cs b/I18N Commander/UI WinForms/Components/SectionTree.cs index 196facd..02ede17 100644 --- a/I18N Commander/UI WinForms/Components/SectionTree.cs +++ b/I18N Commander/UI WinForms/Components/SectionTree.cs @@ -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: diff --git a/I18N Commander/UI WinForms/Program.cs b/I18N Commander/UI WinForms/Program.cs index 5c21401..a26755f 100644 --- a/I18N Commander/UI WinForms/Program.cs +++ b/I18N Commander/UI WinForms/Program.cs @@ -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()