internal async Task <UniversalPackageFile> CreateDirectoryPromptAsync(UniversalPackage.FileCollection collection, string prefix, string name) { try { return(await collection.CreateDirectoryAsync(prefix + name)); } catch (ArgumentException) { name = await this.Dispatcher.InvokeAsync(() => { var prompt = new NamePromptWindow("Folder Name Conflict", "New folder name:", NamePromptWindow.CreateNameValidator(true, collection, collection == this.Package.Metadata, prefix)) { Text = name, Owner = this }; if (prompt.ShowDialog() == true) { return(prompt.Text); } return(null); }); if (name == null) { return(null); } return(await collection.CreateDirectoryAsync(prefix + name)); } }
internal UniversalPackageFile(UniversalPackage.FileCollection collection, string fullName) { this.Collection = collection; this.FullName = fullName; this.children = new Lazy <UniversalPackage.FileCollection.SubTreeCollection>(() => fullName.EndsWith("/", StringComparison.OrdinalIgnoreCase) ? new UniversalPackage.FileCollection.SubTreeCollection(collection, fullName) : null); }