public TransfertFeature(List <Int32> ListArticle = null)
        {
            this.InitializeComponent();
            if (ListArticle == null)
            {
                Model.Local.ArticleRepository ArticleRepository = new Model.Local.ArticleRepository();
                ListArticle = ArticleRepository.ListIdSync(true);
            }
            this.ListCount = ListArticle.Count;

            Context = SynchronizationContext.Current;
            this.ParallelOptions.MaxDegreeOfParallelism = MaximumThreadCount;
            this.ReportProgress(0);
            Task.Factory.StartNew(() =>
            {
                Parallel.ForEach(ListArticle, this.ParallelOptions, Transfert);
            });
        }
Exemplo n.º 2
0
        public TransfertArticleDocument(List <Int32> ListArticle = null)
        {
            this.InitializeComponent();
            if (ListArticle == null)
            {
                Model.Local.ArticleRepository ArticleRepository = new Model.Local.ArticleRepository();
                ListArticle = ArticleRepository.ListIdSync(true);
            }

            Model.Local.AttachmentRepository AttachmentRepository = new Model.Local.AttachmentRepository();
            List <int> listarticlewithdoctosync = AttachmentRepository.ListIDArticleNotSync();

            ListArticle = ListArticle.Where(a => listarticlewithdoctosync.Contains(a)).ToList();

            this.ListCount = ListArticle.Count;
            Context        = SynchronizationContext.Current;
            this.ParallelOptions.MaxDegreeOfParallelism = MaximumThreadCount;
            this.ReportProgress(0);
            Task.Factory.StartNew(() =>
            {
                Parallel.ForEach(ListArticle, this.ParallelOptions, Sync);
            });
        }
        public SynchronisationCatalogueInfoLibre()
        {
            this.InitializeComponent();
            this.worker.WorkerReportsProgress = true;

            // Insérez le code requis pour la création d’objet sous ce point.this.worker.WorkerReportsProgress = true;
            this.worker.DoWork += delegate(object s, DoWorkEventArgs args)
            {
                Model.Local.ArticleRepository ArticleRepository = new Model.Local.ArticleRepository();
                List <Int32> ListArticle = ArticleRepository.ListIdSync(true);

                foreach (Int32 Article in ListArticle)
                {
                    Core.Import.ImportCatalogueInfoLibre Sync = new Core.Import.ImportCatalogueInfoLibre();
                    Sync.Exec(Article);
                    lock (this)
                    {
                        this.CurrentCount += 1;
                    }
                    this.worker.ReportProgress((this.CurrentCount * 100 / ListArticle.Count));
                }
            };

            this.worker.ProgressChanged += delegate(object s, ProgressChangedEventArgs args)
            {
                this.ProgressBarStock.Value   = args.ProgressPercentage;
                this.LabelInformation.Content = "Informations : " + args.ProgressPercentage + " %";
            };

            this.worker.RunWorkerCompleted += delegate(object s, RunWorkerCompletedEventArgs args)
            {
                this.Close();
            };

            // Insérez le code requis pour la création d’objet sous ce point.
            this.worker.RunWorkerAsync();
        }