Skip to content

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

feat: created IBus and unimplemented Bus service

Larsab2dee0826a8
diff --git a/LarsWM.Core/Common/Services/Bus.cs b/LarsWM.Core/Common/Services/Bus.cs
new file mode 100644
index 00000000..dd379349
--- /dev/null
+++ b/LarsWM.Core/Common/Services/Bus.cs
@@ -0,0 +1,43 @@
+using LarsWM.Core.Common.Models;
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace LarsWM.Core.Common.Services
+{
+ /// <summary>
+ /// The event bus
+ /// </summary>
+ public sealed class Bus : IBus
+ {
+ private static readonly IDictionary<Type, Type> RegisteredCommandHandlers = new Dictionary<Type, Type>();
+ private static readonly IDictionary<Type, Type> RegisteredEventHandlers = new Dictionary<Type, Type>();
+
+ /// <summary>
+ /// Sends command to appropriate command handler.
+ /// </summary>
+ public void Invoke<T>(T command) where T : ICommand<object>
+ {
+ // try-catch here? perhaps commands should always return CommandResponse (has State - failure,success, and Data - any return value from command)?
+ throw new NotImplementedException();
+ }
+
+ /// <summary>
+ /// Sends event to appropriate event handler.
+ /// </summary>
+ public void RaiseEvent<T>(T @event) where T : IEvent
+ {
+ throw new NotImplementedException();
+ }
+
+ public void RegisterCommandHandler<T>()
+ {
+ throw new NotImplementedException();
+ }
+
+ public void RegisterEventHandler<T>()
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/LarsWM.Core/Common/Services/IBus.cs b/LarsWM.Core/Common/Services/IBus.cs
new file mode 100644
index 00000000..dfdff9c5
--- /dev/null
+++ b/LarsWM.Core/Common/Services/IBus.cs
@@ -0,0 +1,15 @@
+using LarsWM.Core.Common.Models;
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace LarsWM.Core.Common.Services
+{
+ public interface IBus
+ {
+ void Invoke<T>(T command) where T : ICommand<object>;
+ void RaiseEvent<T>(T @event) where T : IEvent;
+ void RegisterCommandHandler<T>();
+ void RegisterEventHandler<T>();
+ }
+}