dwmkerr / dwmkerr/consolecontrol

Need help

Open
#63 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
786
Forks
166
Avg merge
3d 23h
Merged PRs (30d)
1

Description

Hello
How to use it properly in windows form?
i want set the command in textbox, click a run button and get everything happen in external cmd window

```
private void btnExecute_Click(object sender, EventArgs e)
{
string command = textBox1.Text;

ProcessStartInfo psi = new ProcessStartInfo();
psi.FileName = "cmd.exe";
psi.RedirectStandardInput = true;
psi.RedirectStandardOutput = true;
psi.RedirectStandardError = true;
psi.UseShellExecute = false;
psi.StandardOutputEncoding = Encoding.Default;

consoleControl1.StartProcess(psi);
consoleControl1.OnConsoleOutput += (s, args) =>
{
consoleControl1.WriteOutput(args.Content, Color.White);
};
}

private void btnQuit_Click(object sender, EventArgs e)
{
consoleControl1.StopProcess();
}

private void cleanoutput_Click(object sender, EventArgs e)
{
consoleControl1.ClearOutput();
}
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.