public Task <string> ShowFolderDialogAsync(OpenFolderDialog dialog, IWindowBaseImpl parent) { var events = new SystemDialogEvents(); _native.SelectFolderDialog((parent as WindowImpl)?.Native, events, dialog.Title ?? "", dialog.InitialDirectory ?? ""); return(events.Task.ContinueWith(t => { events.Dispose(); return t.Result.FirstOrDefault(); })); }
public Task <string> ShowFolderDialogAsync(OpenFolderDialog dialog, Window parent) { var events = new SystemDialogEvents(); var nativeParent = GetNativeWindow(parent); _native.SelectFolderDialog(nativeParent, events, dialog.Title ?? "", dialog.InitialDirectory ?? ""); return(events.Task.ContinueWith(t => { events.Dispose(); return t.Result.FirstOrDefault(); })); }
public override async Task <IReadOnlyList <IStorageFolder> > OpenFolderPickerAsync(FolderPickerOpenOptions options) { using var events = new SystemDialogEvents(); var suggestedDirectory = options.SuggestedStartLocation?.TryGetUri(out var suggestedDirectoryTmp) == true ? suggestedDirectoryTmp.LocalPath : string.Empty; _native.SelectFolderDialog((IAvnWindow)_window.Native, events, options.AllowMultiple.AsComBool(), options.Title ?? "", suggestedDirectory); var result = await events.Task.ConfigureAwait(false); return(result?.Select(f => new BclStorageFolder(new DirectoryInfo(f))).ToArray() ?? Array.Empty <IStorageFolder>()); }