public BellyRubProxy(string token, BellyEngine engine, Browser browser) { _token = token; _engine = engine; _browser = browser; _engine .On("engine-pause", m => _client.PauseEngine()) .On("engine-resume", m => _client.ResumeEngine()) .On("build-test-all", m => _client.RunAll()) .On("abort-run", m => _client.AbortRun()) .On("detect-recursion-on-next-run", m => _client.RunRecursiveRunDetection()) .On("goto", msg => _client.GoTo(msg.file.ToString(), (int)msg.line, (int)msg.column)) .On("focus-editor", msg => _client.FocusEditor()) .RespondTo("get-token-path", (msg, respondWith) => respondWith(new { token = _token }) ); _handlers = new Handler[] { new StatusEventHandler(), new ShutdownEventHandler(), new FocusEventHandler(_browser), new RunEventHandler(), new RunItemEventHandler(), new InformationEventsHandler() }; foreach (var handler in _handlers) { handler.DispatchThrough((msg, o) => _engine.Send(msg, o)); } }