Example #1
0
 public OperationalService(IOperationsLauncher operationsLauncher,
                           IScheduler scheduler,
                           ILoggerFactory loggerFactory)
 {
     this.operationsLauncher = operationsLauncher;
     this.scheduler          = scheduler;
     this.loggerFactory      = loggerFactory;
 }
Example #2
0
        private void StartStopButton_Click(object sender, EventArgs e)
        {
            LockApp(true);

            if (_operationLauncher != null && _operationLauncher.IsWorking)
            {
                ReviewsBackgroundWorker.CancelAsync();
                ReviewsWorkerInfos.Text = Resources.StopInProgress;
                StartStopButton.Enabled = false;

            }
            else
            {
                if (!CheckForm())
                    return;
                //IMIRecordsProvider provider;
                //CSVFileProvider.TryBuildProvider(SourceFileTB.Text, out provider);

                var filters = new List<Func<Product, bool>>();

                if (FilterOnReviewsIdsCB.Checked)
                {
                    filters.Add(ProductFiltersBuilder.NewFilterOnIds(IdsToFilterTB.Text));
                }
                else
                {
                    var reviewers = ConfigurationManager.AppSettings["Reviewers"];
                    filters.Add(ProductFiltersBuilder.NewFilterOnReviewers(reviewers));
                    if (FilterOnReviewersCB.Checked)
                    {
                        filters.Add(ProductFiltersBuilder.NewFilterOnReviewers(NewReviewersTB.Text));
                    }
                }

                //Output
                IWriter writer;
                if (DestFileRB.Checked)
                    writer = new LocalFileWriter(DestFileTB.Text);
                else if (DestFtpRB.Checked)
                    writer = new FTPFileWriter(DestFTPDirTB.Text, DestFTPUserTB.Text, DestFTPPasswordTB.Text);
                else
                    throw new InvalidOperationException("Impossible de créer le Writer de sortie. vous n'êtes pas supposés passer dans ce code");

                //_operationsManagerDeprecated = new OperationsManager_Deprecated(provider, writer, LastUpdateDateDTP.Value, OperationsListBox.CheckedItems.Cast<Operation>().ToList());
                var reviewProcessorBuilder = new ReviewProcessorBuilder();
                var operations = OperationsListBox.CheckedItems.Cast<Operation>().ToList();
                _operationLauncher = reviewProcessorBuilder.BuildFor<Album>(SourceFileTB.Text, writer, filters, operations, LastUpdateDateDTP.Value, DoReviewCleaning.Checked);
                //_operationLauncher = new AlbumOperationManager(reviewProcessor, OperationsListBox.CheckedItems.Cast<Operation>().ToList(), writer, );

                ReviewsBackgroundWorker.RunWorkerAsync();
                StartStopButton.Text = Resources.CancelLabel;
                StartStopButton.Enabled = true;
            }
        }
Example #3
0
        private void StartStopButton_Click(object sender, EventArgs e)
        {
            LockApp(true);

            if (_operationLauncher != null && _operationLauncher.IsWorking)
            {
                ReviewsBackgroundWorker.CancelAsync();
                ReviewsWorkerInfos.Text = Resources.StopInProgress;
                StartStopButton.Enabled = false;
            }
            else
            {
                if (!CheckForm())
                {
                    return;
                }
                //IMIRecordsProvider provider;
                //CSVFileProvider.TryBuildProvider(SourceFileTB.Text, out provider);

                var filters = new List <Func <Product, bool> >();

                if (FilterOnReviewsIdsCB.Checked)
                {
                    filters.Add(ProductFiltersBuilder.NewFilterOnIds(IdsToFilterTB.Text));
                }
                else
                {
                    var reviewers = ConfigurationManager.AppSettings["Reviewers"];
                    filters.Add(ProductFiltersBuilder.NewFilterOnReviewers(reviewers));
                    if (FilterOnReviewersCB.Checked)
                    {
                        filters.Add(ProductFiltersBuilder.NewFilterOnReviewers(NewReviewersTB.Text));
                    }
                }

                //Output
                IWriter writer;
                if (DestFileRB.Checked)
                {
                    writer = new LocalFileWriter(DestFileTB.Text);
                }
                else if (DestFtpRB.Checked)
                {
                    writer = new FTPFileWriter(DestFTPDirTB.Text, DestFTPUserTB.Text, DestFTPPasswordTB.Text);
                }
                else
                {
                    throw new InvalidOperationException("Impossible de créer le Writer de sortie. vous n'êtes pas supposés passer dans ce code");
                }

                //_operationsManagerDeprecated = new OperationsManager_Deprecated(provider, writer, LastUpdateDateDTP.Value, OperationsListBox.CheckedItems.Cast<Operation>().ToList());
                var reviewProcessorBuilder = new ReviewProcessorBuilder();
                var operations             = OperationsListBox.CheckedItems.Cast <Operation>().ToList();
                _operationLauncher = reviewProcessorBuilder.BuildFor <Album>(SourceFileTB.Text, writer, filters, operations, LastUpdateDateDTP.Value, DoReviewCleaning.Checked);
                //_operationLauncher = new AlbumOperationManager(reviewProcessor, OperationsListBox.CheckedItems.Cast<Operation>().ToList(), writer, );

                ReviewsBackgroundWorker.RunWorkerAsync();
                StartStopButton.Text    = Resources.CancelLabel;
                StartStopButton.Enabled = true;
            }
        }