private void closeLast_click(object sender, RoutedEventArgs e)
        {
            MyThread m = threads.Last();

            if (m != null)
            {
                if (pause)
                {
#pragma warning disable CS0618 // Le type ou le membre est obsolète
                    m.getThread().Resume();
#pragma warning restore CS0618 // Le type ou le membre est obsolète
                }
                threads.Remove(m);
                m.getThread().Abort();
                if (m.getWorkerInstanceType().IsAssignableFrom(typeof(BallonWorker)))
                {
                    nbballThread--;
                }
                else
                {
                    nbPremierThread--;
                }
                if (threads.Count() == 0)
                {
                    pause = false;
                }
                updateTextblockDispatcher();
            }
        }
        private bool removeMyThread(MyThread m)
        {
            if (m != null)
            {
                if (pause)
                {
#pragma warning disable CS0618 // Le type ou le membre est obsolète
                    m.getThread().Resume();
#pragma warning restore CS0618 // Le type ou le membre est obsolète
                }
                threads.Remove(m);
                m.getThread().Abort();
                if (threads.Count() == 0)
                {
                    pause = false;
                }
                return(true);
            }
            return(false);
        }
        private void closeAllThreads()
        {
            int nb = threads.Count();

            for (int i = nb - 1; i >= 0; i--)
            {
                MyThread t = threads.ElementAt(i);
                t.getThread().Abort();
                threads.Remove(t);
                Debug.WriteLine("closing : " + " i :" + i + t.GetType());
            }
            nbPremierThread = 0;
            nbballThread    = 0;
        }
        private bool removeMyThread(MyThread m)
        {
            if (m != null)
            {
                if (pause)
                {
#pragma warning disable CS0618 // Le type ou le membre est obsolète
                    m.getThread().Resume();
#pragma warning restore CS0618 // Le type ou le membre est obsolète
                }
                threads.Remove(m);
                m.getThread().Abort();
                if (threads.Count() == 0) pause = false;
                return true;        
            }
            return false;
        }
        private void updateTextblock()
        {
            int count = threads.Count();

            textBlock.Text  = count + " threads are running : \n";
            textBlock.Text += "number of ballon threads : " + nbballThread + "\n";
            textBlock.Text += "number of premier threads : " + nbPremierThread + "\n";
            textBlock.Text += "********************************************************** \n";
            if (threads.Count != 0)
            {
                for (int i = 0; i < (threads.Count()); i++)
                {
                    MyThread m = threads.ElementAt(i);
                    textBlock.Text += "Thread number : " + i + " is a thread of " + (m.getWorkerInstanceType().IsAssignableFrom(typeof(PremierWorker)) ? "Premier" : "ballon") + " its id is: " + m.getThread().ManagedThreadId + "\n";
                }
            }
        }