Gérer l’événement ‘ThreadExit’

Author:

Utilitaire,Plateforme:,non,edité
{filelink=17884}

using System;
using System.Windows.Forms;
using System.Threading;

namespace Exemple3
{
    public class EvenementThreadExit : Form
    {
        public EvenementThreadExit()
        {
            Text = "Exemple de l'événement 'ThreadExit'";
        }
        public static void Main()
        {
            EvenementThreadExit FormObject = new EvenementThreadExit();
            ApplicationEventHandlerClass AppEvents = new ApplicationEventHandlerClass();

            Application.ThreadExit += new EventHandler(AppEvents.OnThreadExit);
            Application.Run(FormObject);
        }
    }

    public class ApplicationEventHandlerClass
    {

        public void OnThreadExit(object sender, EventArgs e)
        {
            MessageBox.Show("Le thread de l'application a été arrêté");
        }
    }

}

Leave a Reply

Your email address will not be published. Required fields are marked *