public string OpenFolder(string title, string initialDirectory = null, IntPtr?owner = null) { var builder = new CommonOpenDialogBuilder() .Initialize(title, initialDirectory) .SetAsFolderDialog(); return(OpenSingle(builder, owner)); }
public string OpenFile(string title, string initialDirectory = null, List <DialogFilterPair> filters = null) { var builder = new CommonOpenDialogBuilder() .Initialize(title, initialDirectory) .SetAsFileDialog(false) .AddFilters(filters); return(OpenSingle(builder)); }
public List <string> OpenFiles(string title, string initialDirectory = null, List <DialogFilterPair> filters = null, IntPtr?owner = null) { var builder = new CommonOpenDialogBuilder() .Initialize(title, initialDirectory) .SetAsFileDialog(true) .AddFilters(filters); return(Open(builder, owner)); }
private string OpenSingle(CommonOpenDialogBuilder builder, IntPtr?owner = null) { var files = Open(builder, owner); if (files?.Count == 1) { return(files[0]); } return(null); }
public List <string> Open(CommonOpenDialogBuilder builder, IntPtr?owner = null) { List <string> result = null; using (var dialog = builder.Dialog) { if (dialog.ShowDialog(GetOwnerHandle(owner)) == CommonFileDialogResult.Ok) { result = dialog.FileNames.ToList(); } } return(result); }
public List <string> Open(CommonOpenDialogBuilder builder) { List <string> result = null; using (var dialog = builder.Dialog) { if (dialog.ShowDialog() == CommonFileDialogResult.Ok) { result = dialog.FileNames.ToList(); } } return(result); }
public string OpenFolder(string title, string initialDirectory) { var builder = new CommonOpenDialogBuilder() .Initialize(title, initialDirectory) .SetAsFolderDialog(); string result = null; using (var dialog = builder.Build()) { if (dialog.ShowDialog() == CommonFileDialogResult.Ok) { result = dialog.FileName; } } return(result); }
public List <string> OpenFiles(string title, string initialDirectory, List <DialogFilterPair> filters) { var builder = new CommonOpenDialogBuilder() .Initialize(title, initialDirectory) .SetAsFileDialog(true) .AddFilters(filters); List <string> result = null; using (var dialog = builder.Build()) { if (dialog.ShowDialog() == CommonFileDialogResult.Ok) { result = dialog.FileNames.ToList(); } } return(result); }