make python app load a bit eariler, making startup a bit faster

This commit is contained in:
Alex Bezdieniezhnykh
2025-02-13 18:13:15 +02:00
parent e329e5bb67
commit cfd5483a18
31 changed files with 183 additions and 124 deletions
+6 -2
View File
@@ -8,6 +8,7 @@ using Azaion.Common.DTO;
using Azaion.Common.DTO.Config;
using Azaion.Common.Extensions;
using Azaion.Common.Services;
using Azaion.CommonSecurity.Services;
using Azaion.Dataset;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
@@ -24,20 +25,22 @@ public partial class MainSuite
private readonly IGalleryService _galleryService;
private readonly IDbFactory _dbFactory;
private readonly Dictionary<WindowEnum, Window> _openedWindows = new();
private readonly IResourceLoader _resourceLoader;
public MainSuite(IOptions<AppConfig> appConfig,
IConfigUpdater configUpdater,
IEnumerable<IAzaionModule> modules,
IServiceProvider sp,
IGalleryService galleryService,
IDbFactory dbFactory
)
IDbFactory dbFactory,
IResourceLoader resourceLoader)
{
_configUpdater = configUpdater;
_modules = modules;
_sp = sp;
_galleryService = galleryService;
_dbFactory = dbFactory;
_resourceLoader = resourceLoader;
_appConfig = appConfig.Value;
InitializeComponent();
Loaded += OnLoaded;
@@ -107,6 +110,7 @@ public partial class MainSuite
_openedWindows[module.WindowEnum] = window;
window.Closed += (_, _) =>
{
_resourceLoader.StopPython();
_openedWindows.Remove(module.WindowEnum);
if (!_openedWindows.Any())
Close();