private async void Generate()
        {
            await ToggleBusyAsync(Task.Run(() =>
            {
                foreach (var table in ImportArgumentes)
                {
                    if (table.ImportModel)
                    {
                        GenerateFile(_solution.ModelProjectConfiguration, table, _modelGenerator, table.ModelName);
                    }
                    if (table.ImportRepository)
                    {
                        GenerateFile(_solution.DataProjectConfiguration, table, _repositoryInterfaceGenerator, $"I{table.SingularName}Repository");
                    }
                    if (table.ImportLinqRepository)
                    {
                        GenerateFile(_solution.LinqProjectConfiguration, table, _linqRepositoryGenerator, $"{table.SingularName}Repository");
                    }
                    if (table.ImportRestRepository)
                    {
                        GenerateFile(_solution.RestProjectConfiguration, table, _restRepositoryGenerator, $"{table.SingularName}Repository");
                    }
                }
            }));

            ImportCompleted?.Invoke(this);
            ToastSuccess("Files generated successfully");
            _dialog.Close();
        }
        protected virtual void OnImportCompleted(DataImportCompleteArgs e)
        {
            timer.Stop();
            e.ImportStarted   = importStart;
            e.ImportCompleted = DateTime.Now;
            e.TotalElapsed    = timer.Elapsed;

            ImportCompleted?.Invoke(this, e);
        }
    private async Task extract(StorageFile file, string path)
    {
        string tmpName = string.Empty;

        if (!Directory.Exists(Path.Combine(path, "media")))
        {
            Directory.CreateDirectory(Path.Combine(path, "media"));
        }

        using (ZipArchive archive = ZipFile.OpenRead(Path.Combine(Windows.Storage.ApplicationData.Current.LocalCacheFolder.Path, file.Name)))
        {
            foreach (var entry in archive.Entries)
            {
                tmpName = entry.FullName;

                if (tmpName.EndsWith(".save"))
                {
                    int i = 1;
                    while (File.Exists(Path.Combine(path, tmpName)))
                    {
                        tmpName = entry.FullName.Substring(0, entry.FullName.LastIndexOf('.')) + " (" + i + ").save";
                        i++;
                    }
                }
                else
                {
                    if (File.Exists(Path.Combine(path, tmpName)))
                    {
                        File.Delete(Path.Combine(path, tmpName));
                    }
                }
                try
                {
                    entry.ExtractToFile(Path.Combine(path, tmpName), true);
                }
                catch (Exception ex)
                {
                    Debug.Log(ex.ToString());
                }
            }
        }

        UnityMainThreadDispatcher.Instance().Enqueue(() => {
            var instructionFullPath = Path.Combine(path, tmpName);
            if (File.Exists(instructionFullPath))
            {
                ImportCompleted?.Invoke(this, instructionFullPath);
            }
            else
            {
            }
        });
    }
Exemple #4
0
        private void WorkerRunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            var param = (WorkerParameter)e.Result;

            if (param.Enumerator != null)
            {
                param.Enumerator.Dispose();
            }

            if (ImportCompleted != null)
            {
                ImportCompleted.Invoke(this, new ImportCompletedEventArgs(param.ImportedObjects, param.NumIgnored, param.UserCancelled));
            }
        }
        // TODO Sort out the async and threading model.
        public virtual async Task <Scene> ImportFileAsync(string filePath)
        {
            if (!File.Exists(filePath))
            {
                throw new IOException($"File \"{filePath}\" not found");
            }

            var scene = await ImportFileImpl(filePath).ConfigureAwait(false);

            scene.FilePath = filePath;

            ImportCompleted?.Invoke(this, new FileInfo(filePath));

            _logger?.LogInformation($"File \"{filePath}\" imported sucessfully");
            return(scene);
        }
        private async Task RaiseEventImportCompleted(Guid importId)
        {
            var config = new ProducerConfig
            {
                BootstrapServers      = _configuration["Kafka:BootstrapServers"],
                EnableDeliveryReports = false
            };

            var producer = new ProducerBuilder <Null, string>(config).Build();

            var importCompleted = new ImportCompleted(importId);

            var json = JsonSerializer.Serialize(importCompleted);

            var message = new Message <Null, string>
            {
                Value = json
            };

            await producer.ProduceAsync("products-import-completed", message);
        }
 private void Importer_ImportCompleted(object sender, string e)
 {
     //InstructionManager.Instance.LoadInstruction(e);
     UpdateFileNames();
     ImportCompleted?.Invoke(this, null);
 }
 private void OnImportCompleted()
 {
     ImportCompleted?.Invoke();
 }
Exemple #9
0
        public async Task Handle(ImportCompleted notification)
        {
            await _importRepository.MarkImportCompleted(notification.ImportId, notification.CompletedAt);

            _logger.LogInformation($"IMPORT COMPLETED! - {notification.ImportId}");
        }