private void Btn_go_Click(object sender, RoutedEventArgs e) { int selidx = PyExeList.SelectedIndex; if (selidx >= 0) { if (curproc != null) { curproc.RawProcess.Refresh(); curproc.RawProcess.Close(); txt_content.Clear(); } var environ = Environ.Environments[selidx]; var proc = environ.Run("-i", Environment.CurrentDirectory); proc.RawProcess.OutputDataReceived += RawProcess_OutputDataReceived; proc.RawProcess.ErrorDataReceived += RawProcess_OutputDataReceived; proc.RawProcess.BeginOutputReadLine(); proc.RawProcess.BeginErrorReadLine(); curproc = proc; } }
/// <summary> /// 初始化 /// </summary> private void init() { mSceneRetrivalPy = new PyProcess("SceneRetrieval.py"); //添加事件响应 mSceneRetrivalPy.setOutputHandler(new OutputHandler(handleOutput)); mMessageForm = new MessageForm(); }