/// <inheritdoc/> async Task IEditorApplication.OnImportJsonAsync(string path) { if (path == null) { var dlg = new OpenFileDialog() { Filter = "Json (*.json)|*.json|All (*.*)|*.*", FilterIndex = 0, Multiselect = true, FileName = "" }; if (dlg.ShowDialog(_mainWindow) == true) { var results = dlg.FileNames; foreach (var result in results) { _editor?.OnImportJson(result); } } } else { if (System.IO.File.Exists(path)) { _editor?.OnImportJson(path); } } await Task.Delay(0); }
/// <inheritdoc/> async Task IEditorApplication.OnImportJsonAsync(string path) { try { if (path == null) { var dlg = new OpenFileDialog(); dlg.AllowMultiple = true; dlg.Filters.Add(new FileDialogFilter() { Name = "Json", Extensions = { "json" } }); dlg.Filters.Add(new FileDialogFilter() { Name = "All", Extensions = { "*" } }); var results = await dlg.ShowAsync(_mainWindow); if (results != null) { foreach (var result in results) { _editor?.OnImportJson(result); } } } else { if (_fileIO.Exists(path)) { _editor?.OnImportJson(path); } } } catch (Exception ex) { _log?.LogError($"{ex.Message}{Environment.NewLine}{ex.StackTrace}"); } }