public void ProgressNotifierTicksWithMessagesCorrectly()
        {
            IUserInterface            userInterfaceSubstitute = Substitute.For <IUserInterface>();
            ConsoleProgressVisualizer visualizer =
                new ConsoleProgressVisualizer(userInterfaceSubstitute);

            IProgressNotifier progressNotifier = visualizer.Spawn(100.0, "StartMessage", "CompleteMessage");

            for (int i = 10; i <= 100; i += 10)
            {
                progressNotifier.TickIncrement(10, i.ToString());
            }

            IEnumerable <string> messages = userInterfaceSubstitute
                                            .ReceivedCalls()
                                            .Where(x => x.GetMethodInfo().Name.Equals(nameof(userInterfaceSubstitute.WriteInformation)))
                                            .Select(x => x.GetArguments()[0] as string);

            messages.Should().BeEquivalentTo(new List <string>()
            {
                "[0%] StartMessage",
                "[10%] StartMessage: 10",
                "[20%] StartMessage: 20",
                "[30%] StartMessage: 30",
                "[40%] StartMessage: 40",
                "[50%] StartMessage: 50",
                "[60%] StartMessage: 60",
                "[70%] StartMessage: 70",
                "[80%] StartMessage: 80",
                "[90%] StartMessage: 90",
                "[100%] StartMessage: 100",
                "CompleteMessage",
            });
        }
        /// <summary>
        /// Initializes runner for given feature test class type with given progress notifier.
        /// Given featureTestClass type Name is used as feature name.
        /// If test class is annotated with [FeatureDescription] attribute or implementation specific description attribute, it's content is used as feature description.
        /// </summary>
        /// <param name="featureTestClass">Test class type.</param>
        /// <param name="progressNotifier">Progress notifier.</param>
        /// <param name="metadataProvider">Test metadata provider.</param>
        protected AbstractBDDRunner(Type featureTestClass, TestMetadataProvider metadataProvider, IProgressNotifier progressNotifier)
        {
            if (featureTestClass == null)
            {
                throw new ArgumentNullException("featureTestClass");
            }
            if (metadataProvider == null)
            {
                throw new ArgumentNullException("metadataProvider");
            }
            if (progressNotifier == null)
            {
                throw new ArgumentNullException("progressNotifier");
            }

            _metadataProvider = metadataProvider;
            ProgressNotifier  = progressNotifier;
            _stepsConverter   = new StepsConverter(_metadataProvider, MapExceptionToStatus);
            _result           = new FeatureResult(
                _metadataProvider.GetFeatureName(featureTestClass),
                _metadataProvider.GetFeatureDescription(featureTestClass),
                _metadataProvider.GetFeatureLabel(featureTestClass));
            _executor = new ScenarioExecutor(ProgressNotifier);
            _executor.ScenarioExecuted += _result.AddScenario;
            ProgressNotifier.NotifyFeatureStart(_result.Name, _result.Description, _result.Label);
        }
Exemple #3
0
        public async Task <byte[]> GetAsync(CustomerLedgerSearch option, IProgressNotifier notifier, CancellationToken token = default(CancellationToken))
        {
            var companyTask = companyQueryProcessor.GetAsync(new CompanySearch {
                Id = option.CompanyId,
            }, token);
            var loadTask = customerLedgerProcessor.GetAsync(option, token, notifier);

            await Task.WhenAll(companyTask, loadTask);

            var company = companyTask.Result.First();
            var items   = loadTask.Result.ToList();

            if (!items.Any())
            {
                return(null);
            }

            var report = new CustomerLedgerSectionReport();

            report.SearchOption = option;
            report.SetBasicPageSetting(company.Code, company.Name);
            report.Name = "得意先別消込台帳" + DateTime.Today.ToString("yyyyMMdd");
            report.SetData(items, option.Precision);

            report.Run();

            return(report.Convert());
        }
 public XboxTransferWorker(IXboxGameRepositoryFactory xboxGameRepositoryFactory, string gameName,
                           BlockingCollection <IXboxTransferRequest> requests, BlockingCollection <IXboxTransferRequest> finishedRequests, IProgressNotifier notifier) : base(xboxGameRepositoryFactory, gameName)
 {
     _requests         = requests ?? throw new ArgumentNullException(nameof(requests));
     _finishedRequests = finishedRequests;
     _notifier         = notifier;
 }
        public JobsterBuilder <T> AddProgressNotifier(IProgressNotifier <T> progressNotifier)
        {
            Guard.Argument(progressNotifier, nameof(progressNotifier)).NotNull();

            _configuration.ProgressNotifiers.Add(progressNotifier);

            return(this);
        }
Exemple #6
0
 public Task Download(Uri url, Stream writeStream, IProgressNotifier parentProgress = null)
 {
     return(Download(url, writeStream,
                     string.IsNullOrEmpty(settingsProvider.Settings.HttpProxy)
                         ? null
                         : new WebProxy(new Uri(settingsProvider.Settings.HttpProxy)),
                     parentProgress));
 }
Exemple #7
0
        /// <summary>
        /// Initializes runner for given feature test class type with given progress notifier.
        /// Given featureTestClass type Name is used as feature name.
        /// If test class is annotated with [FeatureDescription] attribute or implementation specific description attribute, it's content is used as feature description.
        /// </summary>
        /// <param name="featureTestClass">Test class type.</param>
        /// <param name="progressNotifier">Progress notifier.</param>
        /// <param name="metadataProvider">Test metadata provider.</param>
        protected AbstractBDDRunner(Type featureTestClass, TestMetadataProvider metadataProvider, IProgressNotifier progressNotifier)
        {
            _metadataProvider = metadataProvider;
            ProgressNotifier  = progressNotifier;

            _result = new FeatureResult(_metadataProvider.GetFeatureName(featureTestClass), _metadataProvider.GetFeatureDescription(featureTestClass), _metadataProvider.GetFeatureLabel(featureTestClass));
            ProgressNotifier.NotifyFeatureStart(_result.Name, _result.Description, _result.Label);
        }
        public AssemblyNode(IOldToNewTupleMap <string> typesMap, ItemNodeBase parent, APIDiffInfo apiDiffInfo, IProgressNotifier progressNotifier, FilterSettings filterSettings)
            : base(Path.GetFileName(typesMap.GetFirstNotNullItem()), parent, apiDiffInfo, filterSettings)
        {
            this.TypesMap = typesMap;

            this.progressNotifier = progressNotifier;

            this.areChildrenLoaded = false;
        }
 public XboxTransferProgressWorker(IXboxGameRepositoryFactory xboxGameRepositoryFactory, string gameName,
                                   IProgressNotifier notifier, BlockingCollection <IXboxTransferRequest> finishedRequests, long totalBytesToUpload, long totalBytesAlreadyUploaded)
 {
     _gameName                  = gameName;
     _notifier                  = notifier;
     _finishedRequests          = finishedRequests;
     _totalBytesToUpload        = totalBytesToUpload;
     _totalBytesAlreadyUploaded = totalBytesAlreadyUploaded;
 }
Exemple #10
0
 public ContrivedPublisher(IWorkSystem startStopper,
                           IProgressNotifier progress, IDataSubscribable <TWorkItem> dataSource)
 {
     _startStopper             = startStopper;
     _progress                 = progress;
     _dataSource               = dataSource;
     progress.ProgressChanged += OnProgressChanged;
     dataSource.AddSubscriber(this);
 }
 public UploadArchivesUseCase(IXboxGameRepositoryFactory xboxGameRepositoryFactory,
                              IProgressNotifier notifier, IZipFileProcessor zipFileProcessor)
 {
     _xboxGameRepositoryFactory = xboxGameRepositoryFactory;
     _notifier                    = notifier;
     _zipFileProcessor            = zipFileProcessor;
     _xboxFtpRequests             = new BlockingCollection <IXboxTransferRequest>();
     _xboxDirectoryCreateRequests = new BlockingCollection <XboxDirectoryCreateRequest>();
 }
Exemple #12
0
        public IDocumentsWriter Create(ChannelReader <List <ReplaceOneModel <BsonDocument> > > batchReader,
                                       IProgressNotifier notifier, bool dryRun)
        {
            var workerFactory = new WriteWorkerFactory(batchReader, _destinationRepositoryFactory, notifier,
                                                       dryRun, _collectionName);

            return(new DocumentsWriter(_insertionWorkersCount, _retryWorkersCount, _collectionName,
                                       workerFactory, _logger));
        }
Exemple #13
0
        public async Task <VirtualFile> DownloadVersion(string version, VirtualDirectory downloadDirectory,
                                                        IProgressNotifier parentProgress = null,
                                                        string proxy = "")
        {
            await EnsureRepository(proxy).ConfigureAwait(false);

            string actualVersion = await CheckVersion(version, proxy).ConfigureAwait(false);

            CliVersionDefinition versionDefinition = repository.Version.FirstOrDefault(v => v.GetInformalVersion() == actualVersion);

            if (versionDefinition == null)
            {
                throw new UnkownVersionException(actualVersion);
            }

            FileDefinition downloadFile = GetCorrectVersion();

            if (downloadFile == null)
            {
                throw new UnsupportedSystemException(environmentService.PlatformName, environmentService.Architecture);
            }

            Uri downloadUri = InvalidUriFormatException.TryCreateUri(downloadFile.relPath,
                                                                     InvalidUriFormatException.TryCreateUri(settingsProvider.Settings.CliRepositoryRoot));
            VirtualFile result = downloadDirectory.File(downloadFile.name);

            using (Stream fileStream = result.OpenWrite())
            {
                await Download(downloadUri, fileStream, proxy, parentProgress).ConfigureAwait(false);
            }

            using (Stream fileStream = result.OpenRead())
            {
                try
                {
                    securityValidator.ValidateHash(fileStream, downloadFile.Fingerprint.hash, downloadFile.Fingerprint.algorithm);
                }
                catch (HashValidationException e)
                {
                    e.ValidationFileName = downloadUri.AbsolutePath;
                    throw;
                }
            }

            return(result);

            FileDefinition GetCorrectVersion()
            {
                FileDefinition[] correctArchitecture = versionDefinition.File
                                                       .Where(f => f.Architecture.ToString().Equals(environmentService.Architecture,
                                                                                                    StringComparison.OrdinalIgnoreCase))
                                                       .ToArray();
                return(correctArchitecture.FirstOrDefault(f => f.OS.ToString().Equals(environmentService.PlatformName,
                                                                                      StringComparison.OrdinalIgnoreCase)) ??
                       correctArchitecture.FirstOrDefault(f => f.OS == OSDefinition.unbound));
            }
        }
 public DeployPackageViewModel(IPackageTask packageTask, IPackageProcessor packageProcessor, IPackageRepository packageRepository, IProgressNotifier progressNotifier, IWindowManager windowManager, IManagePackagesView managePackagesView)
 {
     this.packageTask = packageTask;
     this.packageProcessor = packageProcessor;
     this.packageRepository = packageRepository;
     this.progressNotifier = progressNotifier;
     this.windowManager = windowManager;
     this.managePackagesView = managePackagesView;
     this.progressNotifier.Progress += this.OnProgressUpdate;
 }
Exemple #15
0
 public AudioPipeline(IProgressNotifier progressNotifier = null)
 {
     if (progressNotifier == null)
     {
         progressNotifier = new EmptyProgressNotifier();
     }
     this.ProgressNotifier = progressNotifier;
     this.PitchEffect      = new PitchEffect();
     this.Effects.Add(this.PitchEffect);
 }
 public FileCopyPackageTask(
     IArchiveProcessor archiveProcessor,
     IEnvironmentalTokenResolver environmentalTokenResolver, 
     IProgressNotifier progressNotifier, 
     IReservedTokenResolver reservedTokenResolver)
 {
     this.archiveProcessor = archiveProcessor;
     this.environmentalTokenResolver = environmentalTokenResolver;
     this.progressNotifier = progressNotifier;
     this.reservedTokenResolver = reservedTokenResolver;
 }
Exemple #17
0
 public PackageTokeniser(
     IFileContentProcessor fileContentProcessor,
     IProgressNotifier progressNotifier,
     IRenameFileProcessor renameFileProcessor,
     IBinaryFileFilter binaryFileFilter)
 {
     this.fileContentProcessor = fileContentProcessor;
     this.binaryFileFilter     = binaryFileFilter;
     this.progressNotifier     = progressNotifier;
     this.renameFileProcessor  = renameFileProcessor;
 }
 public PackageTokeniser(
     IFileContentProcessor fileContentProcessor, 
     IProgressNotifier progressNotifier, 
     IRenameFileProcessor renameFileProcessor, 
     IBinaryFileFilter binaryFileFilter)
 {
     this.fileContentProcessor = fileContentProcessor;
     this.binaryFileFilter = binaryFileFilter;
     this.progressNotifier = progressNotifier;
     this.renameFileProcessor = renameFileProcessor;
 }
 public PackageDeploymentProcessor(
     IArchiveProcessor archiveProcessor,
     IEnvironmentalTokenResolver environmentalTokenResolver, 
     IProgressNotifier progressNotifier, 
     IReservedTokenResolver reservedTokenResolver)
 {
     this.archiveProcessor = archiveProcessor;
     this.environmentalTokenResolver = environmentalTokenResolver;
     this.progressNotifier = progressNotifier;
     this.reservedTokenResolver = reservedTokenResolver;
 }
Exemple #20
0
 public PackageDeploymentProcessor(
     IArchiveProcessor archiveProcessor,
     IEnvironmentalTokenResolver environmentalTokenResolver,
     IProgressNotifier progressNotifier,
     IReservedTokenResolver reservedTokenResolver)
 {
     this.archiveProcessor           = archiveProcessor;
     this.environmentalTokenResolver = environmentalTokenResolver;
     this.progressNotifier           = progressNotifier;
     this.reservedTokenResolver      = reservedTokenResolver;
 }
        public FolderNode(IOldToNewTupleMap <string> folderMap, ItemNodeBase parent, APIDiffInfo apiDiffInfo, IProgressNotifier progressNotifier, FilterSettings filterSettings, bool loadChildrenAsync)
            : base(GetName(folderMap), parent, apiDiffInfo, filterSettings)
        {
            this.folderMap = folderMap;

            this.progressNotifier = progressNotifier;

            // This line needs to be before this.IsExpanded = true; in any case.
            this.loadChildrenAsync = loadChildrenAsync;

            this.IsExpanded = true;
        }
Exemple #22
0
 /// <summary>
 /// Method for forwarding <see cref="Progress"/> <see cref="ProgressWatcher.Failed"/> events to our <see cref="Failed"/> event.
 /// </summary>
 /// <param name="progress">Should always be our <see cref="Progress"/>.</param>
 void LoadingFailed(IProgressNotifier progress, string message)
 {
     try
     {
         Failed?.Invoke(this, message);
     }
     catch (Exception e)
     {
         Urho.IO.Log.Write(Urho.LogLevel.Warning,
                           $"There was an unexpected exception during the invocation of {nameof(Finished)}: {e.Message}");
     }
 }
 public WriteWorkerFactory(ChannelReader <List <ReplaceOneModel <BsonDocument> > > batchReader,
                           IDestinationRepositoryFactory repositoryFactory,
                           IProgressNotifier notifier,
                           bool dryRun,
                           string collectionName)
 {
     _batchReader       = batchReader;
     _repositoryFactory = repositoryFactory;
     _notifier          = notifier;
     _dryRun            = dryRun;
     _collectionName    = collectionName;
 }
 public PackageProcessor(
     [Import("FilteredFileSystemArtefactProcessor")]IArtefactProcessor artefactProcessor,
     ICleanUpProcessor cleanUpProcessor,
     IProgressNotifier progressNotifier,
     ITemplateTokeniser templateTokeniser, 
     IBinaryFileFilter binaryFileFilter)
 {
     this.artefactProcessor = artefactProcessor;
     this.binaryFileFilter = binaryFileFilter;
     this.cleanUpProcessor = cleanUpProcessor;
     this.progressNotifier = progressNotifier;
     this.templateTokeniser = templateTokeniser;
 }
Exemple #25
0
 public PackageProcessor(
     [Import("FilteredFileSystemArtefactProcessor")] IArtefactProcessor artefactProcessor,
     ICleanUpProcessor cleanUpProcessor,
     IProgressNotifier progressNotifier,
     ITemplateTokeniser templateTokeniser,
     IBinaryFileFilter binaryFileFilter)
 {
     this.artefactProcessor = artefactProcessor;
     this.binaryFileFilter  = binaryFileFilter;
     this.cleanUpProcessor  = cleanUpProcessor;
     this.progressNotifier  = progressNotifier;
     this.templateTokeniser = templateTokeniser;
 }
Exemple #26
0
 public ConsoleProgressNotifier(
     IUserInterface userInterface,
     double maxTicks,
     string startMessage,
     Action disposeAction     = null,
     IProgressNotifier parent = null)
     : base(userInterface, startMessage, parent)
 {
     this.maxTicks      = maxTicks;
     this.disposeAction = disposeAction ?? (() => { });
     currentTicks       = 0;
     WriteProgress();
 }
 public PackageDeployerTasks(
     IConfiguration configuration,
     IPackageDeploymentProcessor packageDeploymentProcessor,
     IPackageProcessor packageProcessor,
     IPackageRepository packageRepository, 
     IProgressNotifier progressNotifier)
 {
     this.packageDeploymentProcessor = packageDeploymentProcessor;
     this.configuration = configuration;
     this.packageProcessor = packageProcessor;
     this.packageRepository = packageRepository;
     this.progressNotifier = progressNotifier;
     this.progressNotifier.Progress += this.OnProgressUpdate;
 }
Exemple #28
0
 public PackageDeployerTasks(
     IConfiguration configuration,
     IPackageDeploymentProcessor packageDeploymentProcessor,
     IPackageProcessor packageProcessor,
     IPackageRepository packageRepository,
     IProgressNotifier progressNotifier)
 {
     this.packageDeploymentProcessor = packageDeploymentProcessor;
     this.configuration              = configuration;
     this.packageProcessor           = packageProcessor;
     this.packageRepository          = packageRepository;
     this.progressNotifier           = progressNotifier;
     this.progressNotifier.Progress += this.OnProgressUpdate;
 }
        public ProgressFileDownloader(IDev2WebClient webClient, IFile file)
        {
            VerifyArgument.IsNotNull("webClient", webClient);
            VerifyArgument.IsNotNull("file", file);
            _webClient = webClient;

            ProgressDialog = GetProgressDialogViewModel?.Invoke(_owner, Cancel);
            _file          = file;
            _webClient.DownloadProgressChanged += OnDownloadProgressChanged;
            ShutDownAction = ShutdownAndInstall;
            if (!Directory.Exists("Installers"))
            {
                Directory.CreateDirectory("Installers");
            }
        }
        public ProgressFileDownloader(IDev2WebClient webClient, IFile file, ICryptoProvider cryptoProvider)
        {
            VerifyArgument.IsNotNull("webClient", webClient);
            VerifyArgument.IsNotNull("file", file);
            VerifyArgument.IsNotNull("cryptoProvider", cryptoProvider);
            _webClient = webClient;

            ProgressDialog = GetProgressDialogViewModel(_owner, Cancel);
            _file = file;
            _cryptoProvider = cryptoProvider;
            _webClient.DownloadProgressChanged += OnDownloadProgressChanged;
            _dontStartUpdate = false;
            ShutDownAction = ShutdownAndInstall;
            if (!Directory.Exists("Installers"))
                Directory.CreateDirectory("Installers");

        }
Exemple #31
0
        public ProgressFileDownloader(IDev2WebClient webClient, IFile file, ICryptoProvider cryptoProvider)
        {
            VerifyArgument.IsNotNull("webClient", webClient);
            VerifyArgument.IsNotNull("file", file);
            VerifyArgument.IsNotNull("cryptoProvider", cryptoProvider);
            _webClient = webClient;

            ProgressDialog  = GetProgressDialogViewModel(_owner, Cancel);
            _file           = file;
            _cryptoProvider = cryptoProvider;
            _webClient.DownloadProgressChanged += OnDownloadProgressChanged;
            _dontStartUpdate = false;
            ShutDownAction   = ShutdownAndInstall;
            if (!Directory.Exists("Installers"))
            {
                Directory.CreateDirectory("Installers");
            }
        }
Exemple #32
0
        public async Task InstallSdk(VirtualFile packedSdk, VirtualDirectory destination, ChangeObservable observable,
                                     bool force)
        {
            using (IEditableSettings editableSettings = settingsProvider.StartSettingTransaction())
            {
                if (!force && destination.Files(searchRecursive: true).Any())
                {
                    throw new FileExistsException(destination.FullName);
                }

                using (IProgressNotifier progressNotifier = Console.IsInputRedirected || Console.IsOutputRedirected ? null : progressVisualizer.Spawn(1, "Install SDK.", null))
                {
                    await fileUnpackService.Unpack(packedSdk, destination, progressNotifier, observable).ConfigureAwait(false);
                }

                editableSettings.AddSetting(Constants.SdkPathsKey, $"{destination.FullName}");
            }
        }
 public PackageCreatorTasks(
     IArchiveBuilder archiveBuilder,
     ICleanUpProcessor cleanUpProcessor,
     IClonePackageBuilder clonePackageBuilder,
     IConfiguration configuration,
     IPackageBuilder packageBuilder,
     IPackageTokeniser packageTokeniser,
     IProgressNotifier progressNotifier)
 {
     this.archiveBuilder = archiveBuilder;
     this.cleanUpProcessor = cleanUpProcessor;
     this.clonePackageBuilder = clonePackageBuilder;
     this.configuration = configuration;
     this.packageBuilder = packageBuilder;
     this.packageTokeniser = packageTokeniser;
     this.progressNotifier = progressNotifier;
     this.progressNotifier.Progress += this.OnProgressUpdate;
 }
Exemple #34
0
 public PackageCreatorTasks(
     IArchiveBuilder archiveBuilder,
     ICleanUpProcessor cleanUpProcessor,
     IClonePackageBuilder clonePackageBuilder,
     IConfiguration configuration,
     IPackageBuilder packageBuilder,
     IPackageTokeniser packageTokeniser,
     IProgressNotifier progressNotifier)
 {
     this.archiveBuilder             = archiveBuilder;
     this.cleanUpProcessor           = cleanUpProcessor;
     this.clonePackageBuilder        = clonePackageBuilder;
     this.configuration              = configuration;
     this.packageBuilder             = packageBuilder;
     this.packageTokeniser           = packageTokeniser;
     this.progressNotifier           = progressNotifier;
     this.progressNotifier.Progress += this.OnProgressUpdate;
 }
Exemple #35
0
        public async Task <IEnumerable <Collation> > CollateAsync(CollationSearch collationSearch,
                                                                  CancellationToken token    = default(CancellationToken),
                                                                  IProgressNotifier notifier = null)
        {
            var orders = (await getCollationOrderQueryProcessor.GetItemsAsync(collationSearch.CompanyId, token))
                         .Where(x => x.Available == 1)
                         .OrderBy(x => x.ExecutionOrder).ToArray();

            using (var scope = transactionScopeBuilder.Create())
            {
                var collationSetting = (await getCollationSettingQueryProcessor.GetAsync(collationSearch.CompanyId, token));
                collationSearch.SortOrderDirection = collationSetting.SortOrderDirection;

                await collationQueryProcessor.InitializeAsync(collationSearch, token);

                notifier?.UpdateState();

                foreach (var order in orders)
                {
                    switch (order.CollationTypeId)
                    {
                    case 0: await collationQueryProcessor.CollatePayerCodeAsync(collationSearch, token); break;

                    case 1: await collationQueryProcessor.CollateCustomerIdAsync(collationSearch, token); break;

                    case 2: await collationQueryProcessor.CollateHistoryAsync(collationSearch, token); break;

                    case 3: await collationQueryProcessor.CollatePayerNameAsync(collationSearch, token); break;

                    case 4: await collationQueryProcessor.CollateKeyAsync(collationSearch, token); break;
                    }
                    notifier?.UpdateState();
                }
                await collationQueryProcessor.CollateMissingAsync(collationSearch, token);

                notifier?.UpdateState();
                var items = await collationQueryProcessor.GetItemsAsync(collationSearch, token);

                notifier?.UpdateState();

                scope.Complete();
                return(items);
            }
        }
Exemple #36
0
        public async Task InstallVersion(VirtualFile setup, VirtualDirectory tempDirectory, IProgressNotifier parentProgress = null)
        {
            VirtualDirectory destination = tempDirectory.Directory(Guid.NewGuid().ToByteString());

            using (IProgressNotifier progressNotifier = parentProgress?.Spawn(installationSteps.Count() + 1, "Installing version"))
            {
                await fileUnpackService.Unpack(setup, destination, progressNotifier).ConfigureAwait(false);

                foreach (IInstallationStep installationStep in installationSteps)
                {
                    await installationStep.Install(destination, progressNotifier).ConfigureAwait(false);
                }

                await ReplaceApplication().ConfigureAwait(false);
            }

            async Task ReplaceApplication()
            {
                userInterface.WriteInformation("Replace current version with new version");

                if (environmentService.Platform != OSPlatform.Windows)
                {
                    await destination.CopyToAsync(fileSystem.GetDirectory(environmentService.AssemblyDirectory)).ConfigureAwait(false);

                    tempDirectory.Delete();
                }
                else
                {
                    VirtualFile batchFile       = tempDirectory.File("copy_version.bat");
                    Assembly    currentAssembly = Assembly.GetAssembly(GetType());
                    using (Stream batchResourceStream = currentAssembly.GetManifestResourceStream("PlcNext.Common.Installation.copy_version.bat"))
                        using (Stream batchFileStream = batchFile.OpenWrite())
                        {
                            batchResourceStream?.CopyTo(batchFileStream);
                        }

                    processManager.StartProcess(batchFile.FullName,
                                                $"\"{destination.FullName}\" \"{environmentService.AssemblyDirectory}\" " +
                                                $"\"{tempDirectory.FullName}\" \"{binariesLocator.GetExecutable("application").Name}\"", userInterface, null, showOutput: false, showError: false, killOnDispose: false);
                }
            }
        }
 public CreatePackageViewModel(
     IArchiveBuilder archiveBuilder, 
     ICleanUpProcessor cleanUpProcessor, 
     IClonePackageBuilder clonePackageBuilder,
     IPackageBuilder packageBuilder,
     IPackageTokeniser packageTokeniser,
     IProgressNotifier progressNotifier,
     IWindowManager windowManager,
     IManageExclusionsView manageExclusionsView)
 {
     this.archiveBuilder = archiveBuilder;
     this.cleanUpProcessor = cleanUpProcessor;
     this.clonePackageBuilder = clonePackageBuilder;
     this.packageBuilder = packageBuilder;
     this.packageTokeniser = packageTokeniser;
     this.progressNotifier = progressNotifier;
     this.windowManager = windowManager;
     this.manageExclusionsView = manageExclusionsView;
     this.progressNotifier.Progress += this.OnProgressUpdate;
 }
Exemple #38
0
 public Task <IEnumerable <BillingAgingList> > GetAsync(BillingAgingListSearch searchOption,
                                                        IProgressNotifier notifier = null, CancellationToken token = default(CancellationToken))
 {
     return(dbHelper.ExecuteQueriesAsync(async connection =>
     {
         await dbHelper.ExecuteAsync(connection, GetQueryInitializeTempTable(searchOption), searchOption, token);
         notifier?.UpdateState();
         await dbHelper.ExecuteAsync(connection, GetQueryInsertBillingReamin(searchOption), searchOption, token);
         notifier?.UpdateState();
         if (searchOption.BillingRemainType > 0)
         {
             await dbHelper.ExecuteAsync(connection, GetQueryInsertReceiptRemain(searchOption), searchOption, token);
             notifier?.UpdateState();
         }
         await dbHelper.ExecuteAsync(connection, GetQueryInsertMatchingReamin(searchOption), searchOption, token);
         notifier?.UpdateState();
         var items = await dbHelper.QueryAsync <BillingAgingList>(connection, GetQuerySelectBillingAgingList(searchOption), searchOption, token);
         notifier?.UpdateState();
         return items;
     }));
 }
Exemple #39
0
        public async Task <byte[]> GetAsync(CreditAgingListSearch option, IProgressNotifier notifier = null, CancellationToken token = default(CancellationToken))
        {
            var companyTask = companyQueryProcessor.GetAsync(new CompanySearch {
                Id = option.CompanyId,
            }, token);
            var loadTask = creditAgingListProcessor.GetAsync(option, notifier, token);

            await Task.WhenAll(companyTask, loadTask);

            var company = companyTask.Result.First();
            var items   = loadTask.Result.ToList();

            if (!items.Any())
            {
                return(null);
            }

            var title      = "債権総額管理表";
            var outputName = $"{title}{DateTime.Today:yyyyMMdd}";

            var report = new CreditAgingListReport();

            report.Name = outputName;
            report.SetBasicPageSetting(company.Code, company.Name);

            report.DisplayCustomerCode     = option.DisplayCustomerCode;
            report.ConsiderCustomerGroup   = option.ConsiderCustomerGroup;
            report.RequireDepartmentTotal  = option.RequireDepartmentTotal;
            report.RequireStaffTotal       = option.RequireStaffTotal;
            report.UseMasterStaff          = option.UseMasterStaff;
            report.lblArrivalDueDate1.Text = option.ArrivalDueDate1;
            report.lblArrivalDueDate2.Text = option.ArrivalDueDate2;
            report.lblArrivalDueDate3.Text = option.ArrivalDueDate3;
            report.lblArrivalDueDate4.Text = option.ArrivalDueDate4;

            report.SetPageDataSetting(items);
            report.Document.Name = outputName;
            report.Run();
            return(report.Convert());
        }
        /// <summary>
        /// 指定した検索文字列でBing画像検索を行います。<para>
        /// 検索結果の画像URLから画像をダウンロードして内部コレクションに保持します。</para>
        /// </summary>
        /// <param name="searchWord">検索文字列</param>
        /// <param name="progress">進捗状態通知オブジェクト</param>
        /// <param name="page">ページ番号</param>
        /// <param name="imageCountPerPage">ページ当たりの画像数</param>
        public void DownloadSearchResult(string searchWord, IProgressNotifier progress, int page, int imageCountPerPage)
        {
            if (imageCountPerPage < 10)
            {
                throw new ArgumentException(nameof(imageCountPerPage) + " must be 10 or over.", nameof(imageCountPerPage));
            }

            logger.Info("検索中...");
            progress.Start();
            progress.Progress(0);

            var skip = (page - 1) * imageCountPerPage;

            disposable = ServiceClient.SearchImageAsObservable(searchWord, bingAccountKey, skip, imageCountPerPage, ThreadPoolScheduler.Instance)
                .SelectMany(async imageResult => new {
                    imageResult,
                    imageBytes = await DownloadThumbnailImageBytesAsync(imageResult)
                })
                .Where(a => a.imageBytes != null)
                .Select((a,index)=> new{imageResult = a.imageResult, imageBytes = a.imageBytes, index })
                .ObserveOn(UIDispatcherScheduler.Default)
                .Finally(() => progress.End())
                .Subscribe(
                    onNext: a =>
                    {
                        var thumbnail = BitmapImageHelper.CreateBitmap(a.imageBytes);
                        imagesSource.Add(new WebImage(a.imageResult, thumbnail, logger));
                        progress.Progress((double)(a.index + 1) / imageCountPerPage * 100);
                    },
                    onError: e =>
                    {
                        logger.Error("画像の検索に失敗しました。", e);
                    },
                    onCompleted: () =>
                    {
                        logger.Info("検索が完了しました。");
                        progress.Progress(100);
                    });
        }
 public SevenZipBuilder(IProgressNotifier progressNotifier)
 {
     this.progressNotifier = progressNotifier;
 }
        private void SyncEntryPoint(object sender, ElapsedEventArgs e)
        {
            SyncronizerStatus.Enabled = Syncronizer.Enabled = false;
            var Config = new SyncStartingEventArgs();
            OnSyncStarting(Config);
            if (!Config.Cancel)
                try
                {
                    lastNotifier = Config.Notifier;
                    CurrentContext = new ConfigurationModelManager();
                    Config.Notifier.SetProcess("Iniciando conexion");
                    bool finishState = false;
                    Config.Notifier.SetProgress(0);
                    int step = 0;
                    foreach (var item in Steps)
                    {
                        Config.Notifier.SetProgress(++step * 100 / Steps.Count);
                        Config.Notifier.Log(TraceLevel.Verbose, string.Format("Executing {0}, step {1}", item.Method,step));
                        finishState = item(Config);
                        if (!finishState)
                            break;
                    }

                    Config.Notifier.SetUserMessage(!finishState, "Sincronizacion Finalizada");
                    Config.Notifier.SetProgress(100);
                    Config.Notifier.SetProcess(finishState ? "Listo" : "Error");
                    LastSync = DateTime.Now;

                }
                catch (Exception ex)
                {
                    Config.Notifier.Log(TraceLevel.Error, string.Format("Sincronizacion Finalizada con error. {0}", ex));
                    Config.Notifier.SetUserMessage(true, "Sincronizacion Finalizada con error: " + ex.Message);
                    Config.Notifier.SetProgress(100);
                    Config.Notifier.SetProcess("Error");
                }
                finally
                {
                    if (CurrentContext != null)
                        CurrentContext.Dispose();
                }
            Config.Cancel = false;
            OnSyncFinished();
            SyncronizerStatus.Enabled = Syncronizer.Enabled = true;
        }
 public SevenZipProcessor(IErrorLogger errorLogger, IProgressNotifier progressNotifier)
 {
     this.errorLogger = errorLogger;
     this.progressNotifier = progressNotifier;
 }
 public CleanUpProcessor(IProgressNotifier progressNotifier)
 {
     this.progressNotifier = progressNotifier;
 }
 public ExecutionContext(IProgressNotifier progressNotifier, int totalStepCount)
 {
     ProgressNotifier = progressNotifier;
     TotalStepCount = totalStepCount;
 }
 public SevenZipProcessor(IProgressNotifier progressNotifier)
 {
     this.progressNotifier = progressNotifier;
 }
 public TestableBDDRunner(Type featureTestClass, TestMetadataProvider testableMetadataProvider, IProgressNotifier progressNotifier)
     : base(featureTestClass, testableMetadataProvider, progressNotifier) { }
 public ClonePackageBuilder(ICloneFileProcessor cloneFileProcessor, IProgressNotifier progressNotifier)
 {
     this.cloneFileProcessor = cloneFileProcessor;
     this.progressNotifier = progressNotifier;
 }
 public ManifestBuilder([Import("FilteredFileSystemArtefactProcessor")]IArtefactProcessor artefactProcessor, IProgressNotifier progressNotifier)
 {
     this.artefactProcessor = artefactProcessor;
     this.progressNotifier = progressNotifier;
 }
 public void SetUp()
 {
     _console = new ConsoleInterceptor();
     _subject = new ConsoleProgressNotifier();
 }
Exemple #51
0
		/// <summary>
		/// Initializes runner for given test class type with given progress notifier.
		/// Given testClass type Name is used as feature name.
		/// If test class is annotated with [FeatureDescription] or [Description] attribute, it's content is used as feature description.
		/// </summary>
		/// <param name="featureTestClass">Test class type.</param>
		/// <param name="progressNotifier">Progress notifier.</param>
		public BDDRunner(Type featureTestClass, IProgressNotifier progressNotifier)
			: base(featureTestClass, MsTestTestMetadataProvider.Instance, progressNotifier)
		{
		}
Exemple #52
0
 public void SetUp()
 {
     _progressNotifier = MockRepository.GenerateMock<IProgressNotifier>();
     _subject = new BDDRunner(GetType(), _progressNotifier);
 }
 public ScenarioExecutor(IProgressNotifier progressNotifier)
 {
     _progressNotifier = progressNotifier;
 }