コード例 #1
0
        public TransfertPack()
        {
            this.InitializeComponent();
            Model.Local.ArticleRepository ArticleRepository = new Model.Local.ArticleRepository();
            List <Int32> ListArticle = ArticleRepository.ListIdSyncPack(true);

            // récupération des éléments du pack
            //foreach (Int32 ArticleSend in ListArticle)
            //{
            //    Model.Local.Article Article = ArticleRepository.ReadArticle(ArticleSend);
            //    if (Article.Art_Pack == true)
            //    {
            //        List<Int32> PackElements;
            //        SynchronisationArticle.ReadPackElements(ArticleRepository, Article, out PackElements);
            //        ListArticle.AddRange(PackElements);
            //    }
            //    ListArticle.Add(ArticleSend);
            //}

            this.ListCount = ListArticle.Count;

            Context = SynchronizationContext.Current;
            this.ParallelOptions.MaxDegreeOfParallelism = MaximumThreadCount;
            this.ReportProgress(0);
            Task.Factory.StartNew(() =>
            {
                Parallel.ForEach(ListArticle, this.ParallelOptions, Transfert);
            });
        }