It's 2020 and it is time for text mode with Gui.cs
Nearly 16 years ago I complained that Windows is completely missing the TextMode boat. It's 2020 and it's TIME FOR TEXT MODE BABY.
I keep bumping into cool utilities made with Gui.cs. Miguel de Icaza made Midnight Commander (not Norton Commander, but evocative of it) and it's a joy.
Head out to an admin command prompt on your Windows 10 machine now and install it (assuming a recent Windows 10 build, you'll have winget):
winget install GNU.MidnightCommander
You run it with "mc" and even better if you've got Windows Terminal blinged out you'll be able bask in the ASCII COATED GLORY:
It works in WSL as well, since there's a Linux version with "apt install mc" so check that out, too!
Do YOU want to make apps like this? While Midnight Commander wasn't made with Gui.cs, it could have been. I spent YEARS making awesome text mode apps with TurboVision. Now we can make text mode apps with C#! There is even a complete Xterm/Vt100 emulator as well in the form of TerminalView.cs.
Is it hard? Nah! Go "dotnet new console
" then "dotnet add package Terminal.Gui
" and then copy these lines over the ones that are given you in Program.cs, then "dotnet run
". Boom.
using Terminal.Gui;
class Demo {
static int Main ()
{
Application.Init ();
var n = MessageBox.Query (50, 7,
"Question", "Do you like console apps?", "Yes", "No");
return n;
}
}
There you go! You should go read about it now!
If you want to see all the cool text controls you can use, check out the Terminal.Gui UI Catalog app and its source code.
Sure, it's not that new-fangled HTML, but let me tell you, you see these apps every day. The airport, the DMV, the mechanic, the doctor's office. Apps like these are FAST. It's useful to know that these kinds of apps exist...you'll never know when you might need to get back in to TEXT MODE!
Sponsor: Suffering from a lack of clarity around software bugs? Give your customers the experience they deserve and expect with error monitoring from Raygun.com. Installs in minutes, try it today!
About Scott
Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.
About Newsletter
World needs something like:
dotnet tool install FarManager --global
Developing Console-based UI in C#
Simple. Raw speed and productivity. Nothing beats Text-Mode when it comes to fast data input. With any modern computer, the bottleneck for data input is ALWAYS the user. Text-Mode and a trained user allow muscle-memory to be used, greatly optimizing the process.
No wonder check-in counters in airports use text-mode terminals. Hundreds of thousands of people use them every single day in a moderately sized airport, not to mention LAX, JFK, Schippol, Heathrow, ...
Decades ago, when MFC was king, I had to write an app with a relatively sophisticated form (and some pop-ups) that had to run on Win16, Win32 and OS/2, and then back-ported to DOS (it was *that* long ago). I had completed the Win16 version with MSVC/MFC first, and coming up with the Win32 version wasn't too much effort, at least as far as the (MFC-based) UI was concerned. The OS/2 UI libraries were surprisingly (to me at the time) similar in design to raw Windows C, so I wrote a tiny MFC-like wrapper for OS/2 to build the UI so the top-most layer consisted of source files that were shared between all 3 projects.
Then came the need to support DOS...I spent quite a bit of time writing CButton, CListBox, CComboBox and similar classes, with support for tabbing, hotkeys, etc and even drop shadows when a window was made to pop up on top of another. Ultimately I managed to get it evolved enough that again, I could share the top-layer UI code. Being at my first dev job in my 20s, I was rather proud of myself as I thought it looked *really* good, and consistency was key for our customers. The one complaint I got was that I had not built in any support for the mouse...in text mode...
Unfortunately it wasn't without its own set of quirks, and I never fully managed to get away from a few platform-specific items that I had to fix with #ifdef conditionals. But it was fun to put together and learned a lot in the process.
Oddly, on both machines I've installed it on (with winget) I have had to manually add the directory to the PATH env var.
I created a little DSL for Powershell UIs: <a href=""https://github.com/code-numericoverflow/UIfied"" title=""UIfied"">UIfied</a>
It's multi-UI (Console, WPF, Web)
I do not miss it ;)
Over the years I've tried to convince a number of people that they're totally missing the boat and should try Total Commander, but have not succeeded a single time. I've only met two other people in all that time that use it and they totally get it. Unbelievable...
Anyway, this is really cool. I'm all over it!
Oh I still sometimes miss 0XB8000000. Not having internet had some advantage,it forced us to unknowingly reinvent the wheel by reading books / printed code listings in PC magazines!
Definitely looking at it for future projects though.
Comments are closed.
I played with Gui.cs. It's really nice and powerful. I would definitely go for it if I was not already using Far Manager with FarNet. I'd like to share my way though, it has some advantages.