From 8ac8b7875887a791c9e749a6e31498d4f7d501bd Mon Sep 17 00:00:00 2001 From: Alex Macocian Date: Wed, 14 May 2025 12:08:14 +0200 Subject: [PATCH] Add switch for showing main window on startup --- WpfExtended/Launch/ExtendedApplication.cs | 8 ++++++-- WpfExtended/WpfExtended.csproj | 10 +++++----- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/WpfExtended/Launch/ExtendedApplication.cs b/WpfExtended/Launch/ExtendedApplication.cs index 6494467..813255b 100644 --- a/WpfExtended/Launch/ExtendedApplication.cs +++ b/WpfExtended/Launch/ExtendedApplication.cs @@ -19,6 +19,7 @@ namespace System.Windows.Extensions private readonly ServiceCollection services = new(); protected IServiceProvider ServiceProvider { get; private set; } + protected virtual bool ShowWindowOnStartup { get; set; } = true; public ExtendedApplication() { @@ -93,8 +94,11 @@ namespace System.Windows.Extensions service.OnStartup(); } - var window = this.ServiceProvider.GetRequiredService(); - window.Show(); + if (this.ShowWindowOnStartup) + { + var window = this.ServiceProvider.GetRequiredService(); + window.Show(); + } } private void RegisterInternals() { diff --git a/WpfExtended/WpfExtended.csproj b/WpfExtended/WpfExtended.csproj index fe4c231..5e5dab0 100644 --- a/WpfExtended/WpfExtended.csproj +++ b/WpfExtended/WpfExtended.csproj @@ -6,7 +6,7 @@ true true License.txt - 0.7.7 + 0.7.8 latest Extension library for Windows Presentation Platform. @@ -92,12 +92,12 @@ http://www.java2s.com/Open-Source/CSharp_Free_Code/Windows_Presentation_Foundati - - + + - - + +