using WirelessTextSyncer.Windows.Models; namespace WirelessTextSyncer.Windows.Services; public sealed class SyncMessageHandler { private readonly IKeyboardInjectionService keyboard; public SyncMessageHandler(IKeyboardInjectionService keyboard) { this.keyboard = keyboard; } public void Handle(SyncMessage message) { switch (message.Action) { case SyncAction.InsertText: keyboard.InsertText(message.Text ?? string.Empty); break; case SyncAction.Backspace: keyboard.Backspace(); break; case SyncAction.Enter: keyboard.Enter(); break; case SyncAction.Ping: break; default: throw new InvalidOperationException($"Unsupported sync action: {message.Action}"); } } }