-1

I have a console app that is running multiple worker threads. I would like the console output to have one WriteLine to report the status of each thread. I know I can simply clear, and loop through my threads to report their status on some interval, but at the same time I want to type commands that would be processed by the application using ReadLine(). Is there a common approach to maintain the top x lines of a console to show scrolling or updated info, and have a line below them where I can type in commands and show results of those commands?

Roger
  • 2,063
  • 4
  • 32
  • 65

1 Answers1

0

That's generally not how consoles work. You could however choose some sort of workarounds as suggested in the answers to this duplicate question: Multithreading: simultaneous console in- and output. It is suggested there to override contents of the window and/or maintain the input by taking it character by character and redisplaying it.

You could also consider writing a simple non-console application (WinForms, WPF, UWP, etc.) to display a console-like output and input box.

Cheers

oelsardine
  • 96
  • 1
  • 7
  • agree that my question is a similar or duplicate of his, but ... I still wanted to do this in a console app, so added an answer to his question: https://stackoverflow.com/a/46356493/1132773 – Roger Sep 22 '17 at 03:46