private void ServerStart(object sender = null, EventArgs e = null) { try { _httpServer = new HttpServer((int)PluginUI.TextPort.Value); _httpServer.ReceivedCommandRequest += DoTextCommand; _httpServer.ReceivedWayMarksRequest += DoWaymarks; _httpServer.ReceivedSendKeyRequest += DoSendKey; _httpServer.ReceivedMarkingRequest += DoMarking; _httpServer.OnException += OnException; PluginUI.ButtonStart.Enabled = false; PluginUI.ButtonStop.Enabled = true; PluginUI.Log($"在{_httpServer.Port}端口启动监听"); } catch (Exception ex) { OnException(ex); } }
private void ServerStart(object sender = null, EventArgs e = null) { try { _httpServer = new HttpServer((int)PluginUI.TextPort.Value); _httpServer.ReceivedCommandRequest += DoTextCommand; _httpServer.ReceivedWayMarksRequest += DoWaymarks; PluginUI.ButtonStart.Enabled = false; PluginUI.ButtonStop.Enabled = true; PluginUI.Log($"在{_httpServer.Port}端口启动监听"); } catch (Exception ex) { PluginUI.Log($"无法在{_httpServer.Port}端口启动监听\n{ex.Message}"); } }