Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor Win32 file dialog API #2492

Merged
merged 10 commits into from
Apr 3, 2024
Merged

Conversation

AmelBawa-msft
Copy link
Contributor

@AmelBawa-msft AmelBawa-msft commented Mar 30, 2024

Summary of the pull request

  • Added support for file dialogs using win32 API:

    • Open file dialog
    using var fileDialog = new WindowOpenFileDialog();
    
    fileDialog.AddFileType("YAML files", ".yaml", ".yml", ".winget");
    fileDialog.AddFileType("Image files", ".png", ".gif");
    
    StorageFile? file = await fileDialog.ShowAsync(window);
    • Open folder dialog
    using var folderDialog = new WindowOpenFolderDialog();
    
    StorageFolder? folder = await folderDialog.ShowAsync(window);
    • Save file dialog
    using var fileDialog = new WindowSaveFileDialog();
    
    fileDialog.AddFileType("YAML files", ".yaml", ".yml", ".winget");
    fileDialog.AddFileType("Image files", ".png", ".gif");
    
    var filePath = fileDialog.Show(window);
  • This PR also replaces the folder picker usage in Repo and Dev Drive pages preventing the app from crashing in admin mode

References and relevant issues

Detailed description of the pull request / Additional comments

Validation steps performed

PR checklist

  • Closes #xxx
  • Tests added/passed
  • Documentation updated

@@ -7,3 +7,14 @@ List of common controls that are generic, customizable and reusable from all pag

## Controls
- [CloseButton](./CloseButton.md)

Copy link
Collaborator

Choose a reason for hiding this comment

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

❤️ docs

@krschau
Copy link
Collaborator

krschau commented Apr 1, 2024

@joadoumie Let's use this -- doesn't matter in widgets which can't run as admin, but potentially someone could use the AC picker somewhere else.

@AmelBawa-msft AmelBawa-msft added the Needs-Second Pull request that needs another approval label Apr 1, 2024
@AmelBawa-msft AmelBawa-msft added this to the Dev Home v0.13 milestone Apr 1, 2024
@joadoumie
Copy link
Contributor

@joadoumie Let's use this -- doesn't matter in widgets which can't run as admin, but potentially someone could use the AC picker somewhere else.

This is just to replace the file picker for #2477?

@krschau
Copy link
Collaborator

krschau commented Apr 3, 2024

@joadoumie Let's use this -- doesn't matter in widgets which can't run as admin, but potentially someone could use the AC picker somewhere else.

This is just to replace the file picker for #2477?

I haven't really looked into it yet, but if it makes sense we should use this new, admin-safe API when we launch the file picker from AC.

@AmelBawa-msft AmelBawa-msft merged commit 43a8e7e into main Apr 3, 2024
4 checks passed
@AmelBawa-msft AmelBawa-msft deleted the user/amelbawa/file-dialog branch April 3, 2024 20:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs-Second Pull request that needs another approval
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants