/// /// Copyright (c) 2013-2017 Sensus Metering Systems /// using System; using System.Drawing; using System.Windows.Forms; using TBF.Resources; namespace TBF.Forms { public partial class ClosingProgram : Form { Timer timer; public ClosingProgram() { InitializeComponent(); label1.Text = Strings.Closing_Test_Bench_Framework; float textWidth = Graphics.FromImage(new Bitmap(1, 1)).MeasureString(label1.Text, label1.Font).Width; Width = (int)textWidth + 120; /// Form width calculated from the text width 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(); } } } }