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 { } }); }
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 void Importer_ImportCompleted(object sender, string e) { //InstructionManager.Instance.LoadInstruction(e); UpdateFileNames(); ImportCompleted?.Invoke(this, null); }
private void OnImportCompleted() { ImportCompleted?.Invoke(); }