Files
Toolkit2/Toolkit.Foundation/MicrocontrollerContext.cs
T
Dan Clark 0afe621f59 Refactor
2025-02-09 13:51:25 +00:00

24 lines
843 B
C#

using CommunityToolkit.Mvvm.Messaging;
namespace Toolkit.Foundation;
public class MicroControllerContext<TRead, TEvent>(IReadOnlyCollection<IMicroControllerModuleDescriptor> modules,
IMessenger messenger,
ISerialContext serialContext) :
IMicroControllerContext<TRead, TEvent>
where TEvent : ISerialEventArgs<TRead>
{
public async Task InitializeAsync()
{
//eventAggregator.Subscribe<SerialResponse<TRead>>(OnEvent, null, args => args.Context.Equals(serialContext));
serialContext.Open();
await Task.CompletedTask;
}
private async void OnEvent(SerialResponse<TRead> args)
{
//IMicrocontrollerModule? module = await messenger.SendAsync<IMicrocontrollerModule>(new TReadDeserializer { Read = args.Content }, modules);
//messenger.Send((dynamic?)module);
}
}