Skip to content

GlazeWM is a tiling window manager for macOS and Windows inspired by i3wm.

feat: added basic DI configuration to Program, register Bus & Startup as a service

Lars554143ba5b2b
diff --git a/LarsWM.Core/Program.cs b/LarsWM.Core/Program.cs
index fa0d07c0..10e804f3 100644
--- a/LarsWM.Core/Program.cs
+++ b/LarsWM.Core/Program.cs
@@ -1,4 +1,6 @@
-using System;
+using LarsWM.Core.Common.Services;
+using Microsoft.Extensions.DependencyInjection;
+using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Windows.Forms;
@@ -15,14 +17,24 @@ namespace LarsWM.Core
{
Debug.WriteLine("Application started");
- //Application.Run();
+ var serviceCollection = new ServiceCollection();
+ ConfigureServices(serviceCollection);
- new Startup();
+ var serviceProvider = serviceCollection.BuildServiceProvider();
+
+ var startup = serviceProvider.GetRequiredService<Startup>();
+ startup.Init();
// TODO: Read config file and initialise UserConfig class with its values
// TODO: Register windows hooks
// TODO: Create a workspace and assign a workspace to each connected display
// TODO: Force initial layout
- }
+ }
+
+ private static void ConfigureServices(ServiceCollection serviceCollection)
+ {
+ serviceCollection.AddSingleton<IBus, Bus>();
+ serviceCollection.AddSingleton<Startup>();
+ }
}
}