Esempio n. 1
0
        private async Task InternalSynchronizeSeedForFeatureAsync(IFeatureInfo feature, bool withDemoData = false)
        {
            this.Logger.LogInformation($"Loading seed data for feature: '{feature.Id}'");

            var initDataJobs = await _harvester.HarvestInitDataAsync(feature);

            await _importer.ImportAsync(initDataJobs);

            if (withDemoData)
            {
                var demoJobs = await _harvester.HarvestDemoDataAsync(feature);

                await _importer.ImportAsync(demoJobs);
            }
        }
Esempio n. 2
0
        public static IDataImportResult Import(this IDataImporter dataImporter, IConfiguration configuration)
        {
            if (dataImporter == null)
            {
                throw new ArgumentNullException(nameof(dataImporter));
            }

            return(dataImporter.ImportAsync(configuration, new ImportOptions()).Result);
        }
        protected override void OnShown(EventArgs e)
        {
            base.OnShown(e);

            var totalWork = _importer.ImportAsync();

            if (totalWork > 0)
            {
                pgbImport.Maximum = totalWork;
            }
        }
Esempio n. 4
0
        public async Task Run(TaskExecutionContext ctx, CancellationToken cancelToken = default)
        {
            var request = new DataImportRequest(ctx.ExecutionInfo.Task.Alias.ToInt())
            {
                ProgressCallback = OnProgress
            };

            // Process!
            await _importer.ImportAsync(request, cancelToken);

            Task OnProgress(int value, int max, string msg)
            {
                return(ctx.SetProgressAsync(value, max, msg, true));
            }
        }