public string devicesPlus()
{
psi.Arguments = "start-server";
call = Process.Start(psi);
call.OutputDataReceived += new DataReceivedEventHandler(call_OutputDataReceived);
call.ErrorDataReceived += new DataReceivedEventHandler(call_OutputDataReceived);
call.EnableRaisingEvents = true;
call.Exited += new EventHandler(call_Exited);
call.Start();
call.BeginOutputReadLine();
call.BeginErrorReadLine();
call.StandardInput.Close();
call.WaitForExit();
return outData.ToString();
}
private void call_OutputDataReceived(object sender, DataReceivedEventArgs e)
{
if (e.Data != null)
{
outData.Append(e.Data);
}
}
現在,當我打電話給devicesPlus時,有一段時間我只有*守護進程沒有運行。現在開始它* 有一段時間,它只是在後臺工作,沒有結果.. 你能告訴我什麼是錯誤的代碼,爲什麼我沒有得到正確的返回像cmd .. 新的C#對不起英語不好。 ..
更新 如果我從我的應用程序外殺死adb我突然從我的軟件得到答覆。
的代碼不能工作張貼的UseShellExecute屬性賦值丟失。不使用CreateNoWindow並且不重定向輸入是有風險的。很明顯,如果你沒有發佈準確的代碼,你就無法得到準確的答案。 – 2013-05-11 09:54:04
我知道它的先生,psi是抽象類的一部分.. – user1965804 2013-05-11 10:01:14