//応答なしにならないようにメッセージループを回す public static bool DoEvents(Form self = null, string message = null) { if (System.Threading.Thread.CurrentThread.IsBackground) {//スレッド処理 停止の確認 return(false); } if (message == null) { //nop } else if (LastPleaseWaitStaticCache != null) { LastPleaseWaitStaticCache.Message(message); } else if (self != null) { NotifyPleaseWaitUserControl c = GetControll <NotifyPleaseWaitUserControl>(self, null); if (c != null) {//表示している. c.Message(message); LastPleaseWaitStaticCache = c; } } else {//ウィンドウがない状態 return(false); } //ループを回す Application.DoEvents(); //停止は受け付けない! return(false); }
public static void HidePleaseWait(Form self) { NotifyPleaseWaitUserControl c = GetControll <NotifyPleaseWaitUserControl>(self, null); if (c != null) {//表示しているなら消す self.Controls.Remove(c); LastPleaseWaitStaticCache = null; } }
public static bool IsPleaseWaitDialog(Form self) { if (self == null) { self = LastActiveForm; if (self == null) { return(false); } } NotifyPleaseWaitUserControl c = GetControll <NotifyPleaseWaitUserControl>(self, null); return(c != null); }
public static void ShowPleaseWait(Form self) { if (GetControll <NotifyPleaseWaitUserControl>(self, null) != null) {//既に表示中. return; } NotifyPleaseWaitUserControl notifyControl = new NotifyPleaseWaitUserControl(); notifyControl.Location = new System.Drawing.Point ( (self.Width - notifyControl.Width) / 2 , (self.Height - notifyControl.Height) / 2 ); notifyControl.Hide(); self.Controls.Add(notifyControl); notifyControl.BringToFront(); notifyControl.Show(); notifyControl.Update(); LastPleaseWaitStaticCache = notifyControl; }