public ImportPrestashopArticle(bool forceImportProduct) { this.InitializeComponent(); Model.Prestashop.PsProductRepository PsProductRepository = new Model.Prestashop.PsProductRepository(); List <UInt32> ListPsProduct = PsProductRepository.ListId(Core.Global.CurrentShop.IDShop); if (!forceImportProduct) { Model.Local.ArticleRepository ArticleRepository = new Model.Local.ArticleRepository(); List <Int32> listlocal = ArticleRepository.ListPrestashop(); ListPsProduct = ListPsProduct.Where(ps => !listlocal.Contains((int)ps)).ToList(); } this.ListCount = ListPsProduct.Count; this.Context = SynchronizationContext.Current; this.ParallelOptions.MaxDegreeOfParallelism = MaximumThreadCount; this.ReportProgress(0); Task.Factory.StartNew(() => { Parallel.ForEach(ListPsProduct, this.ParallelOptions, Sync); }); }