private void ConvertFiles()
        {
            // Prepare conversions.
            for (int index = 0; index < this.ConvertionJobs.Count; index++)
            {
                this.ConvertionJobs[index].PrepareConversion();
            }

            // Convert!
            Thread[] jobThreads = new Thread[this.numberOfConversionThread];
            while (true)
            {
                // Compute conversion flags.
                ConversionFlags conversionFlags   = ConversionFlags.None;
                bool            allJobAreFinished = true;
                for (int jobIndex = 0; jobIndex < this.conversionJobs.Count; jobIndex++)
                {
                    ConversionJob conversionJob = this.conversionJobs[jobIndex];
                    allJobAreFinished &= !(conversionJob.State == ConversionJob.ConversionState.Ready ||
                                           conversionJob.State == ConversionJob.ConversionState.InProgress);

                    if (conversionJob.State == ConversionJob.ConversionState.InProgress)
                    {
                        conversionFlags |= conversionJob.StateFlags;
                    }
                }

                if (allJobAreFinished)
                {
                    break;
                }

                // Start job if possible.
                for (int jobIndex = 0; jobIndex < this.conversionJobs.Count; jobIndex++)
                {
                    ConversionJob conversionJob = this.conversionJobs[jobIndex];
                    if (conversionJob.State == ConversionJob.ConversionState.Ready &&
                        conversionJob.CanStartConversion(conversionFlags))
                    {
                        // Find a thread to execute the job.
                        Thread jobThread = null;
                        for (int threadIndex = 0; threadIndex < jobThreads.Length; threadIndex++)
                        {
                            Thread thread = jobThreads[threadIndex];
                            if (thread == null || !thread.IsAlive)
                            {
                                jobThread = Helpers.InstantiateThread(conversionJob.GetType().Name, this.ExecuteConversionJob);
                                jobThreads[threadIndex] = jobThread;
                                break;
                            }
                        }

                        if (jobThread != null)
                        {
                            jobThread.Start(conversionJob);

                            while (conversionJob.State == ConversionJob.ConversionState.Ready)
                            {
                                Debug.Log("Wait the launch of the conversion thread before launching any other thread.");
                                Thread.Sleep(20);
                            }
                        }

                        break;
                    }
                }

                Thread.Sleep(50);
            }

            if (this.Settings.ExitApplicationWhenConversionsFinished)
            {
                bool allConversionsSucceed = true;
                for (int index = 0; index < this.conversionJobs.Count; index++)
                {
                    allConversionsSucceed &= this.conversionJobs[index].State == ConversionJob.ConversionState.Done;
                }

                if (this.cancelAutoExit)
                {
                    return;
                }

                if (allConversionsSucceed)
                {
                    float remainingTime = this.Settings.DurationBetweenEndOfConversionsAndApplicationExit;
                    while (remainingTime > 0f)
                    {
                        if (this.OnApplicationTerminate != null)
                        {
                            this.OnApplicationTerminate.Invoke(this, new ApplicationTerminateArgs(remainingTime));
                        }

                        System.Threading.Thread.Sleep(1000);
                        remainingTime--;

                        if (this.cancelAutoExit)
                        {
                            return;
                        }
                    }

                    if (this.OnApplicationTerminate != null)
                    {
                        this.OnApplicationTerminate.Invoke(this, new ApplicationTerminateArgs(remainingTime));
                    }

                    Dispatcher.BeginInvoke((Action)(() => Application.Current.Shutdown()));
                }
            }
        }