using System; using System.Windows.Forms; namespace TBF.Forms { public partial class ClosingProgram : Form { Timer timer; public ClosingProgram() { InitializeComponent(); timer = new Timer(); timer.Interval = 1000; timer.Tick += new EventHandler(timer_Tick); timer.Start(); } void timer_Tick(object sender, EventArgs args) { if (!TBF.BenchControl.StateMachine.Running) { timer.Stop(); timer.Dispose(); DialogResult = DialogResult.OK; Close(); } } } }