- runtime:仿真 WinForms 子集(Form、Button、Label、TextBox、ComboBox、 GroupBox、Timer、MessageBox、界面线程消息循环、跨线程检查)、 教材设备类库(DeviceCtrlHelper、LED 控件)、运行器(常驻编译服务 + 运行模式) - server:Bun + Hono,WebSocket 会话,每次运行一个进程,消息转发 - web:Vue + Naive UI,WinForms 风格窗体渲染、MessageBox、实训台 LED 屏 - 端到端测试与 100 个程序并发的压力测试 - 教材逐任务摘要(docs/教材摘要) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
27 lines
981 B
C#
27 lines
981 B
C#
// 运行器与服务器之间的消息格式,对应 shared/protocol.ts,两边修改时要同步。
|
||
// 运行器 → 服务器的消息在各处用 JsonObject 直接构造;这里只集中定义从服务器收到的动作。
|
||
using System.Text.Json.Nodes;
|
||
|
||
namespace Sim.Host;
|
||
|
||
/// <summary>浏览器上报的用户操作(shared/protocol.ts 中的 UserAction)</summary>
|
||
public sealed class UserAction
|
||
{
|
||
public required string Action { get; init; }
|
||
public string? Value { get; init; }
|
||
public int Index { get; init; }
|
||
public string Button { get; init; } = "left";
|
||
public int X { get; init; }
|
||
public int Y { get; init; }
|
||
|
||
public static UserAction FromJson(JsonObject json) => new()
|
||
{
|
||
Action = (string?)json["action"] ?? "",
|
||
Value = (string?)json["value"],
|
||
Index = (int?)json["index"] ?? -1,
|
||
Button = (string?)json["button"] ?? "left",
|
||
X = (int?)json["x"] ?? 0,
|
||
Y = (int?)json["y"] ?? 0,
|
||
};
|
||
}
|