public override void Refresh() { FForm.Cursor = Cursors.WaitCursor; try { CD dat = gridMain.Grid.Value as CD; SetStatusCount(0); try { Application.DoEvents(); if (gridMain != null && gridMain.Grid != null) { WaitForm.Start(gridMain.Grid); } //TreeList.Reload(); SetList.Load(); } finally { WaitForm.Stop(); Application.DoEvents(); } gridMain.Grid.SetDataSource(SetList); SetStatusCount(SetList.CountAll, SetList.Count); gridMain.Grid.Value = dat; } finally { gridMain.Grid.ValueEventDisabled = false; FForm.Cursor = Cursors.Default; } }
static public void Start(Control parent) { try { Rectangle rect = (parent == null) ? Rectangle.Empty : parent.RectangleToScreen(parent.ClientRectangle); close = false; FormDelegate d = delegate() { WaitForm frm = new WaitForm(); if (rect != Rectangle.Empty) { frm.StartPosition = FormStartPosition.Manual; frm.Location = new Point(rect.Left + (rect.Width - frm.Width) / 2, rect.Top + (rect.Height - frm.Height) / 2); } System.Windows.Forms.Timer tm = new System.Windows.Forms.Timer(); tm.Interval = 50; tm.Tick += new EventHandler(delegate(object sender, EventArgs e) { if (close) { frm.Close(); } else { Application.DoEvents(); } }); tm.Start(); frm.ShowDialog(); }; d.BeginInvoke(null, null); } catch (Exception exp) { throw exp; } }