Ada*_*nes 7 .net c# windows winforms
我有一个被调用的方法,虽然我希望在方法完成后显示消息框(现在在调用方法后直接显示消息框):
if (Check == true)
{
StartConvIpod();
}
else
{
}
MessageBox.Show("Operation Successful!");
Run Code Online (Sandbox Code Playgroud)
StartConvIpod:
private void StartConvIpod()
{
string res = Directory.EnumerateFiles("dump").
OrderBy(x => File.GetCreationTime(x)).Last();
string sub = res.Substring(5);
string sub2 = sub.Substring(0, sub.Length - 4);
Process p = new Process();
p.StartInfo.WorkingDirectory = "dump";
p.StartInfo.FileName = "ffmpeg.exe";
p.StartInfo.Arguments = "-i " + sub + " -f mp4 -vcodec mpeg4 -b 700k -aspect 4:3 -r 23.98 -s 320x240 -acodec ac3 -ar 48000 iPodConversions\\" + sub2 + ".mp4";
p.Start();
}
Run Code Online (Sandbox Code Playgroud)
Jas*_*own 11
你想要添加这个:
p.Start();
p.WaitForExit(); // or p.WaitForExit(Timeout-Period-In-Milliseconds);
Run Code Online (Sandbox Code Playgroud)
在代码的末尾使用它:
p.WaitForExit();
Run Code Online (Sandbox Code Playgroud)
不要忘记检查其返回值以确保它确实成功,但是:
if(p.ExitCode == 0) { // Or whatever return code you're expecting
//...
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7205 次 |
| 最近记录: |