コード例 #1
0
 /// <summary>
 /// Shows the process panel.
 /// </summary>
 /// <param name="parent">The parent.</param>
 /// <param name="strMessage">The string message.</param>
 /// <param name="intSplashScreenDelayTime">The int splash screen delay time.</param>
 public static void ShowProcessPanel(Control parent, string strMessage, int intSplashScreenDelayTime = 0)
 {
     if (parent.InvokeRequired)
     {
         parent.BeginInvoke(new MethodInvoker(delegate
         {
             ShowProcessPanel(parent, strMessage, intSplashScreenDelayTime);
         }));
     }
     else
     {
         parent.VisibleChanged -= new EventHandler(parent_VisibleChanged);
         parent.VisibleChanged += new EventHandler(parent_VisibleChanged);
         parent.FindForm().FormClosing -= ControlHelper_FormClosing;
         parent.FindForm().FormClosing += ControlHelper_FormClosing;
         Control control = null;
         lock (parent)
         {
             control = HaveProcessPanelControl(parent);
             if (control == null)
             {
                 control = CreateProgressPanel();
                 parent.Controls.Add(control);
             }
         }
         Forms.FrmWaiting frmWaitingEx = control.Tag as Forms.FrmWaiting;
         frmWaitingEx.Msg = strMessage;
         frmWaitingEx.ShowForm(intSplashScreenDelayTime);
     }
 }
コード例 #2
0
 /// <summary>
 /// Closes the waiting.
 /// </summary>
 /// <param name="control">The control.</param>
 private static void CloseWaiting(Control control)
 {
     Control[] array = control.Controls.Find("myprogressPanelext", false);
     if (array.Length > 0)
     {
         Control control2 = array[0];
         if (control2.Tag != null && control2.Tag is Forms.FrmWaiting)
         {
             Forms.FrmWaiting frmWaitingEx = control2.Tag as Forms.FrmWaiting;
             if (frmWaitingEx != null && !frmWaitingEx.IsDisposed && frmWaitingEx.Visible)
             {
                 frmWaitingEx.Hide();
             }
         }
     }
 }