Skip to content

Commit

Permalink
multiple filepicker
Browse files Browse the repository at this point in the history
- #1262
- minor correction in PickMultipleFilesAsync() usage.
- disabled dragdrop on library due to crash. (in Add wallpaper dialog is still present.)
  • Loading branch information
rocksdanister committed Jun 11, 2022
1 parent 0b46173 commit bf959e7
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
13 changes: 10 additions & 3 deletions src/Lively/Lively.UI.WinUI/ViewModels/AddWallpaperViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,17 @@ private async Task FileBrowseAction()
{
filePicker.FileTypeFilter.Add(item);
}
var file = await filePicker.PickSingleFileAsync();
if (file != null)
var files = await filePicker.PickMultipleFilesAsync();
if (files.Count > 0)
{
await AddWallpaperFile(file.Path);
if (files.Count == 1)
{
await AddWallpaperFile(files[0].Path);
}
else
{
AddWallpaperFile(files.Select(x => x.Path).ToList());
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ private async void FolderDropDownOpenFileBtn_Click(object sender, RoutedEventArg
filePicker.FileTypeFilter.Add(item);
}
var selectedFiles = await filePicker.PickMultipleFilesAsync();
if (selectedFiles != null)
if (selectedFiles.Count > 0)
{
var destFiles = new List<string>();
var destFolder = Path.Combine(Path.GetDirectoryName(libraryItem.FilePath), lp.Value["folder"].ToString());
Expand Down
2 changes: 1 addition & 1 deletion src/Lively/Lively.UI.WinUI/Views/Pages/LibraryView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
xmlns:local="using:Lively.UI.WinUI.Views.Pages"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:toolkit="using:CommunityToolkit.WinUI.UI.Controls"
AllowDrop="True"
AllowDrop="False"
DragLeave="Page_DragLeave"
DragOver="Page_DragOver"
Drop="Page_Drop"
Expand Down

0 comments on commit bf959e7

Please sign in to comment.