public NettoyageImage()
        {
            this.InitializeComponent();
            Model.Prestashop.PsImageRepository PsImageRepository = new Model.Prestashop.PsImageRepository();
            List <UInt32> ListPsImage = PsImageRepository.ListId(Core.Global.CurrentShop.IDShop);

            this.ListCount = ListPsImage.Count;
            this.Context   = SynchronizationContext.Current;
            this.ReportProgress(0);
            Task.Factory.StartNew(() =>
            {
                Parallel.ForEach(ListPsImage, Clean);
            });
        }
Ejemplo n.º 2
0
        public ImportPrestashopArticleImage(bool forceImportImage)
        {
            this.InitializeComponent();
            Model.Prestashop.PsImageRepository PsImageRepository = new Model.Prestashop.PsImageRepository();
            List <UInt32> ListPsImage = PsImageRepository.ListId(Core.Global.CurrentShop.IDShop);

            if (!forceImportImage)
            {
                Model.Local.ArticleImageRepository ArticleImageRepository = new Model.Local.ArticleImageRepository();
                List <Int32?> ListArticleImage = ArticleImageRepository.List().Select(ai => ai.Pre_Id).ToList();
                ListPsImage = ListPsImage.Where(i => ListArticleImage.Count(ai => ai != null && ai.Value == i) == 0).ToList();
            }

            this.ListCount = ListPsImage.Count;
            this.Context   = SynchronizationContext.Current;
            this.ParallelOptions.MaxDegreeOfParallelism = MaximumThreadCount;
            this.ReportProgress(0);
            Task.Factory.StartNew(() =>
            {
                Parallel.ForEach(ListPsImage, this.ParallelOptions, Sync);
            });
        }