Skip to content

[wasm] download selected file on double click - #1345

Merged
clairernovotny merged 3 commits into
NuGetPackageExplorer:mainfrom
campersau:wasmdownloadfile
Aug 14, 2021
Merged

clairernovotny merged 3 commits into
NuGetPackageExplorer:mainfrom
campersau:wasmdownloadfile

Conversation

@campersau

Copy link
Copy Markdown
Collaborator

Will automatically get more awesome with unoplatform/uno#6619

behavior:TreeViewBehavior.EnableSelectedItemBinding="True"
behavior:TreeViewBehavior.SelectedItem="{Binding SelectedContent, Mode=TwoWay}"
behavior:TreeViewBehavior.AutoToggleItemExpansion="True"
behavior:TreeViewBehavior.DoubleClickCommand="{Binding DoubleClickCommand}"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Double-clicking can trigger unintentionally. Wouldn't it make more sense to put this in a r-click menu with "save as ..."?
image

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that it also possible. But right clicks to open custom context menus aren't very common on the web, that's why I went for double click. (It is also used to download a package from the feed, so there is a little symmetry to that.)


public async Task DoubleClick()
{
if (SelectedContent is IFile file)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would wrap this entire method in #if __WASM__ || __MACOS__ or #if !HAS_UNO_SKIA_GTK, because FileSavePicker arnt supported yet for GTK. While no one uses NPE on that platform atm, but it is better to be safe.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess it will be supported soon: unoplatform/uno#6544
But yes, I could #if it for now.

@clairernovotny
clairernovotny merged commit 22cecae into NuGetPackageExplorer:main Aug 14, 2021
@campersau
campersau deleted the wasmdownloadfile branch August 14, 2021 16:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants