I only have a basic understanding of the C# language but I am troubled, my program uses Powershell to perform tasks.
My specific problem is I am unable to attach an another event handler which can listen for a key press after the user has clicked a button, I'll explain.
- User clicks button
- Network trace begins using powershell (a user controls when to stop the trace)
- My temp solution is to display a messagebox, when this is closed..
- Stop the network trace
Is there anyway I can replace my message box where a user can press space to stop the trace?
Thankyou for your time and help in advance.
public void button3_Click(object sender, EventArgs e)
{
///////////
ps.AddScript("netsh trace start persistent=yes capture=yes tracefile=" + progpath + @"\nettrace.etl");
ps.Invoke();
MessageBox.Show("Press OK to stop the trace");
ps.AddScript("netsh trace stop");
/////////
}