I'm trying to figure out how to read from the standard input stream of my own WPF application but I can't find a way to get the stream. The standard way to do it,
Console.ReadLine()
returns Null(Nothing) immediately. I'm assuming because it's not a console application and no console window is open. How can I read from standard input in a WPF application?
Some backgroud: I'm trying to read text being sent in by an external device (magnetic card reader) which sends its data to stdin of the currently focused application. I can set focus on a TextBox and then read the data from there if I have to but I would much rather read the data directly if possible to avoid a host of possible issues.
Edit: Even though Daniel Pratt solved my original problem it would still be nice to figure out how to read from stdin. If you can answer it I'll change the accepted answer.