我正在運行一個進程(exe文件),同時我想要一個'等待'窗口彈出。 使用BGW:backgroundWorker與進程和模態窗口
public void RunDesign()
{
BackgroundWorker m_oWorker = new BackgroundWorker();
m_oWorker.DoWork += new DoWorkEventHandler(m_oWorker_DoWork);
m_oWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(m_oWorker_RunWorkerCompleted);
m_oWorker.RunWorkerAsync();
// I want the following pop up window to be shown, while my exe file is running
wait_debug _wait_debug = new wait_debug();
Process[] ExeName = Process.GetProcessesByName("AB"); //this is the exe file
if (ExeName.Length == 1)
{
_wait_debug.ShowDialog(); // Show() doesn't work either
_wait_debug.TopMost = true;
}
}
在m_oWorker.DoWork
方法我跑我的過程與p.StartInfo
並運行良好。 我的問題是沒有顯示wait_debug窗口。 任何想法?
在調試器中,它是否真的到達'_wait_debug.ShowDialog();'由於'if'後衛? – MickyD
是的。我放了一個斷點,它顯示該進程沒有運行。只有在我繼續跑步之後,運動員才能運行。 –