private void button1_Click(object sender, EventArgs e) { cmdProcess p = new cmdProcess(); string arguments = "-list_devices true -f dshow -i dummy"; p.InitP(arguments); p.ErrorDataReceived += new DataReceivedEventHandler(dShow_Append); p.Start(); //启动线程 p.BeginErrorReadLine(); //开始异步读取 p.WaitForExit(); //阻塞等待进程结束 p.Close(); //关闭进程 p.Dispose(); }
private void chance_option_Click(object sender, EventArgs e) { cmdProcess p = new cmdProcess(); string arguments = "-list_options true -f dshow -i video=\"" + dShow_Name.Text + "\""; p.InitP(arguments); p.ErrorDataReceived += new DataReceivedEventHandler(option_Append); p.Start(); p.BeginErrorReadLine(); p.WaitForExit(); p.Close(); p.Dispose(); }
private void startLive_Click(object sender, EventArgs e) { if (!String.IsNullOrEmpty(tip.Text) && liveReady) { liveP = new cmdProcess(); Console.WriteLine(tip.Text); liveP.InitP(tip.Text); liveP.Start(); liveP.ErrorDataReceived += new DataReceivedEventHandler(show_liveState); liveP.BeginErrorReadLine(); } else { tip.Text = "请先设置好参数"; } }