private void ReadInput() { while (!_disposed) { try { var evtText = _mouseMeat.StandardOutput.ReadLine(); var evt = JsonConvert.DeserializeObject <Event>(evtText); _eventProcessor.StoreEvent(evt); switch (evt.Type) { case EventType.DeviceInfo: _eventProcessor.DeviceInfo(evt.DeviceInfo); break; case EventType.Move: _eventProcessor.Move(evt.Move); break; } } catch when(_disposed) { // we don't really care if something bad happens while we're tearing down } } }