-
Notifications
You must be signed in to change notification settings - Fork 230
Expand file tree
/
Copy pathCmdConsole.cs
More file actions
35 lines (26 loc) · 837 Bytes
/
CmdConsole.cs
File metadata and controls
35 lines (26 loc) · 837 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
using System;
using System.Windows.Forms;
namespace ConsolePanel.Implementation.CmdProcess
{
class CmdConsole : IConsole
{
readonly ConsoleControl cmd;
public CmdConsole() : this(null)
{
}
public CmdConsole(string workingDirectory)
{
cmd = new ConsoleControl(true, workingDirectory) { Text = "cmd" };
cmd.Exited += (sender, e) => Exited?.Invoke(sender, e);
}
public Control ConsoleControl => cmd;
public string WorkingDirectory
{
set => cmd.WorkingDirectory = value;
}
public event EventHandler Exited;
public void Clear() => cmd.SendString("cls");
public void Cancel() => cmd.Cancel();
public void SendString(string str) => cmd.SendString(str, false);
}
}