我是新来的c#,我发现它与我的PHP起源很不一样,所以我可能会完全错误。不过从我的理解来看,这相当准确。基本上我需要启动一个按钮单击我的表单(该部分完美工作)的程序,然后当用户关闭程序我需要运行一个动作,在这种情况下,我显示一个消息框。如何在程序关闭后运行操作?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;
using System.Windows.Forms;
namespace usb
{
class Applications
{
//condition variables
public static bool CalcStatus = false;
public static void Calc()
{
Process CALC;
CALC = Process.Start("calc.exe");
if (CALC.HasExited)
{
MessageBox.Show("CALC has exited");
CalcStatus = true;
}
}
}
}
这个片段是一个类的一部分,和其他类使用这个功能,当它被称为钙会打开盒子时,计算的关闭将不会与警报弹出。有谁知道我做错了什么?任何更多的指针也欢迎我还在学习:)
[这个答案](http://stackoverflow.com/a/611127)把它描述得很好 – Default