1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
| //*********************************************************************************************************
//
//
//
//---------------------------------------------------------------------------------------------------------
static public void pause(int p_delai_pause)
{
BackgroundWorker pauseExecution = new BackgroundWorker();
m_delai_pause = p_delai_pause;
//-------------------------------------------------------------------------
// Créer un nouveau worker en arrière-plan pour réaliser la tâche de pause
//-------------------------------------------------------------------------
pauseExecution.DoWork += COutils.pause_background;
pauseExecution.RunWorkerAsync();
//-------------------------------------------------------------
// Rafraichir l'interface jusqu'à ce que le worker ait terminé
//-------------------------------------------------------------
while (pauseExecution.IsBusy)
{
Application.DoEvents();
}
}
//*********************************************************************************************************
//
// utilisé par fonction 'pause'
//
//---------------------------------------------------------------------------------------------------------
static public void pause_background(object sender, DoWorkEventArgs e)
{
Thread.Sleep(m_delai_pause);
} |
Partager