Initialize Windows desktop skeleton

This commit is contained in:
Misaka
2026-05-15 20:12:07 +08:00
commit 498251ad79
12 changed files with 334 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
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}");
}
}
}