using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace WWPipeLine.MapBasic { public partial class WaitingForm : Form { public WaitingForm(EventHandler Method, string msg) { InitializeComponent(); if (!string.IsNullOrEmpty(msg)) uiLineMsg.Text = msg; _Method = Method; } private EventHandler _Method; private IAsyncResult asyncResult; private void WaitingForm_Shown(object sender, EventArgs e) { asyncResult = _Method.BeginInvoke(null, null, null, null); } private void timerS_Tick(object sender, EventArgs e) { if (asyncResult.IsCompleted) this.Close(); } } }