开发者

Visual C# forms and command line interface

I'm trying to implement a command-line interface inside of a Windows Forms form. I've looked into PDCurses, but I'm not sure if that's where I want to be. What开发者_StackOverflow should I do?


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.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜