WIP FileSelector
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
using Avalonia.Controls;
|
||||
using Toolkit.Foundation;
|
||||
|
||||
namespace Toolkit.Avalonia;
|
||||
|
||||
public class FileSelector :
|
||||
IFileSelector
|
||||
{
|
||||
public async Task<IEnumerable<string>> SelectFiles(FileFilter filter)
|
||||
{
|
||||
//TopLevel topLevel = TopLevel.GetTopLevel(control);
|
||||
|
||||
//var openFileDialog = new OpenFileDialog();
|
||||
//openFileDialog.Filters.Add(new FileDialogFilter
|
||||
//{
|
||||
// Name = filter.Name,
|
||||
// Extensions = filter.Extensions
|
||||
//});
|
||||
|
||||
//openFileDialog.AllowMultiple = filter.AllowMultiple;
|
||||
|
||||
//var results = await openFileDialog.ShowAsync(window as Window);
|
||||
|
||||
//if (results != null && results.Length > 0)
|
||||
//{
|
||||
// return results.Select(result => result);
|
||||
//}
|
||||
return Enumerable.Empty<string>();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
namespace Toolkit.Foundation;
|
||||
|
||||
public record FileFilter(string Name, List<string> Extensions, bool AllowMultiple = false);
|
||||
@@ -0,0 +1,6 @@
|
||||
namespace Toolkit.Foundation;
|
||||
|
||||
public interface IFileSelector
|
||||
{
|
||||
Task<IEnumerable<string>> SelectFiles(FileFilter filter);
|
||||
}
|
||||
Reference in New Issue
Block a user