public void LoadBatchList(string filePath)
        {
            if (ProductionThread?.IsAlive == true)
            {
                switch (MessageBox.Show("Une production est en cours!\nStopper la production?", "Chargement de fichier", MessageBoxButton.YesNoCancel, MessageBoxImage.Warning))
                {
                case MessageBoxResult.Cancel: return;

                case MessageBoxResult.No: return;

                case MessageBoxResult.Yes: ResetProduction();
                    break;
                }
            }
            BatchList.Batches.Clear();
            try
            {
                using (XmlReader reader = XmlReader.Create(filePath))
                {
                    BatchList.XmlRead(reader);
                }
            }
            catch (System.Exception e)
            {
                MessageBox.Show(CorruptedFileMessage + e.Message, "Erreur", MessageBoxButton.OK, MessageBoxImage.Error);
            }

            BatchList.InitBatchesProperties(PaintingMachineConfiguration, BucketMovingTime);
        }
 /// <summary>
 /// The default Constructor.
 /// </summary>
 public PaintingMachine(string ip = "0.0.0.0", int port = 0,
                        PaintingMachineConfiguration paintingMachineConfiguration = null)
 {
     Port = port;
     Ip   = ip;
     PaintingMachineConfiguration = paintingMachineConfiguration ?? new PaintingMachineConfiguration();
     sender                   = new IPEndPoint(IPAddress.Any, 0);
     BatchList                = new BatchList();
     checkConnectionTimer     = new Timer(CheckConnection, null, 0, 200);
     paintInjectionStopWatch  = new Stopwatch();
     batchProductionStopWatch = new Stopwatch();
 }