views:

31

answers:

1

Hello, I'm trying to implement a command line interface inside of a windows form, I've looked into PDCurses but I'm not sure if thats where I want to be. Any one have any suggestions for this?

+2  A: 

There are two basic approaches, though I'm not sure which goal you're aiming for:

If you want to have an actual command window inside your app:

  • Create a text box. Let them type whatever they want.
  • When the user hits ENTER, read the current line and use the System.Diagnostic.Process classes to execute that line and retrieve the resulting text.
  • Display the resulting text in your textbox.
  • Optional: Prevent the textbox from getting too large by throwing away lines from the top when it gets too big.

If you want to simply create a custom command-processing window:

  • Find a way to parse the input and provide syntax errors.
  • Create an object model that corresponds to the features your app will make available to your console.
  • Connect the parser/interpreter to your object model.
John Fisher