Files
PantherByte/PantherByte/Services/FileService.cs
T
2025-09-12 21:08:49 -04:00

26 lines
762 B
C#

using System.Threading.Tasks;
using Avalonia.Controls;
using Avalonia.Platform.Storage;
namespace PantherByte.Services;
public class FileService : IFileSaveService {
private readonly Window _target;
public FileService(Window target) {
_target = target;
}
/// <summary>
/// Opens a file picker for the user and returns the path of the file they'd like to create.
/// </summary>
/// <returns>A filepath to the user's selected save location.</returns>
public async Task<IStorageFolder?> ChooseFolderAsync() {
var folderList = await _target.StorageProvider.OpenFolderPickerAsync(new FolderPickerOpenOptions() {
Title = "Choose Download Location",
});
return folderList[0];
}
}