This project is read-only.

WPF Terminal

A simple terminal-like textbox.


> Users can only write after the prompt.
> Built-in command completion by pressing TAB key, just register your commands.
> Pressing Enter key validates the input.
> Everything is event-based, so you can interface it easily without changing the code.
> Command and arguments are parsed. Arguments can be simple words (anything but a whitespace character) or quoted arguments in order to include spaces.
> NEW : Abort request event is raised when the user enters CTRL+C

Basic mechanisms

Actually what I did was to define a lastPromptIndex integer, and everytime a user presses the ENTER key and a new prompt appears, this value is updated.
After that, it's simple, you just need to process any text input before the textbox validates the input. If the textbox caret was located before your lastPromptIndex, you need to raise an error (usually a beep sound) and you must invalidate the text input, so nothing is written in the textbox. I also automatically set the caret position to the end of the textbox, so the user can immediatly input some text.

Call to developers

I do not have much time for this project, and only update it when I need a special feature in my other projects that use this terminal. As a result, do not hesitate to tell me your feature suggestions, and also to share your modifications !


Note that I applied a gray background and a white foreground to the textbox. It can be done easily since it is just a normal textbox.


Last edited Oct 29, 2010 at 3:18 PM by AurelienRibon, version 6