Ejemplo n.º 1
0
        public ChangeStorageMode()
        {
            this.InitializeComponent();

            Model.Local.ArticleImageRepository ArticleImageRepository = new Model.Local.ArticleImageRepository();
            List <Model.Local.ArticleImage>    ListImage = ArticleImageRepository.List();

            this.ListCount = ListImage.Count;

            Context = SynchronizationContext.Current;
            this.ParallelOptions.MaxDegreeOfParallelism = MaximumThreadCount;
            this.ReportProgress(0);
            Task.Factory.StartNew(() =>
            {
                Parallel.ForEach(ListImage, this.ParallelOptions, ExecImage);
            });
        }
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);
            });
        }