private async Task NewInstallHandler() { var specDialog = new InstallationSpecBuilderDialog(); if (specDialog.ShowDialog() != DialogResult.OK) { return; } using (_lock.Lock()) { try { await Task.Run(() => _factorio.GetStandaloneInstallation(specDialog.SpecResult)); Installations.Clear(); Installations.AddRange(_factorio.EnumerateInstallations()); } catch (UnauthorizedAccessException) { Error = "Could not access the directory."; } catch (DirectoryNotFoundException) { Error = "Invalid directory."; } catch (IOException) { Error = "The path exists as a file, or is on an unmapped drive."; } catch (SecurityException) { Error = "Not authorized to access the directory."; } } }