Skip to content

Experimental Microsoft.Windows.Storage.Pickers.* API #5240

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

Merged
merged 57 commits into from
Mar 26, 2025

Conversation

Hong-Xiang
Copy link
Contributor

Draft implementation for Microsoft.Windows.Storage.Pickers.* APIs following spec #5155.

DinahK-2SO and others added 30 commits December 12, 2024 14:01
…4945)

Creating new API Microsoft.Windows.Storage.Pickers.FileOpenPicker.PickSingleFileAsync
…ype-workingdir\Microsoft.Storage.Pickers

Squashed commit of the following:

commit 4ce840f
Author: Dinah Gao <x.kic8462852@gmail.com>
Date:   Wed Dec 11 15:00:41 2024 +0800

    add one telemetry

commit bbf72f8
Author: Dinah Gao <116714259+DinahK-2SO@users.noreply.github.com>
Date:   Tue Dec 10 11:01:23 2024 +0800

    Microsoft.Windows.Storage.Pickers.FileOpenPicker.PickSingleFileAsync (#4945)

    Creating new API Microsoft.Windows.Storage.Pickers.FileOpenPicker.PickSingleFileAsync

commit ff3f2a8
Author: Xiang Hong <hx.hongxiang@gmail.com>
Date:   Mon Dec 9 18:14:16 2024 +0800

    fix: fix project configuration and add certificate notes to README.md

commit e11c8e6
Author: Xiang Hong (from Dev Box) <xianghong@microsoft.com>
Date:   Sun Dec 8 20:54:23 2024 +0800

    update readme for folder description

commit c6966f3
Author: Xiang Hong (from Dev Box) <xianghong@microsoft.com>
Date:   Sun Dec 8 20:08:46 2024 +0800

    add a simple READEME

commit c17750f
Author: Xiang Hong (from Dev Box) <xianghong@microsoft.com>
Date:   Sun Dec 8 11:27:04 2024 +0800

    feature: add basic implementations for SavePickers FileExtension/SuggestedSaveFile/Name functionalities

commit 3be9dc1
Author: Xiang Hong (from Dev Box) <xianghong@microsoft.com>
Date:   Sun Dec 8 10:35:59 2024 +0800

    clean: code clean on naming styles etc

commit 9fcc249
Author: Xiang Hong (from Dev Box) <xianghong@microsoft.com>
Date:   Sat Dec 7 22:22:21 2024 +0800

    refactor: use WinRT MD5 hash string to Guid

commit 756bafa
Author: Xiang Hong (from Dev Box) <xianghong@microsoft.com>
Date:   Sat Dec 7 22:02:55 2024 +0800

    fix: fix file type filter issues and refactor to use PickParameters

commit 8dea72a
Author: Xiang Hong (from Dev Box) <xianghong@microsoft.com>
Date:   Sat Dec 7 19:46:45 2024 +0800

    feature: add COM FileSavePicker basic implementation

commit 37a5a75
Author: Xiang Hong <hx.hongxiang@gmail.com>
Date:   Sat Dec 7 17:13:55 2024 +0800

    add save file dialog usage in demo app

commit fc9a03a
Author: Xiang Hong <hx.hongxiang@gmail.com>
Date:   Sat Dec 7 12:06:47 2024 +0800

    feature: add folder functionalities to demo test app

commit 34556bd
Author: Xiang Hong <hx.hongxiang@gmail.com>
Date:   Fri Dec 6 22:51:55 2024 +0800

    feature: add COM based picker prototype basic implementation
msbuild dev\WindowsAppRuntime_DLL\WindowsAppRuntime_DLL.vcxproj
msbuild dev\Projections\CS\Microsoft.Windows.Storage.Pickers.Projection\Microsoft.Windows.Storage.Pickers.Projection.csproj
…_graceful_solution

Add the storage prickers project to solution; Merge latest main to our dev branch.
commit 4a6b97a
Author: Dinah Gao <x.kic8462852@gmail.com>
Date:   Tue Jan 14 13:43:22 2025 +0800

    create file for fileSavePicker

commit 369651d
Author: Dinah Gao <x.kic8462852@gmail.com>
Date:   Mon Jan 13 18:13:47 2025 +0800

    save investigation progress

commit f025b64
Author: Dinah Gao <x.kic8462852@gmail.com>
Date:   Mon Jan 13 11:54:10 2025 +0800

    update doc

commit cc4b8cb
Author: Dinah Gao <x.kic8462852@gmail.com>
Date:   Mon Jan 13 11:47:36 2025 +0800

    atls.lib

commit dc26511
Author: Dinah Gao <x.kic8462852@gmail.com>
Date:   Fri Jan 10 17:56:21 2025 +0800

    COM APIs

commit d0f487c
Author: Dinah Gao <x.kic8462852@gmail.com>
Date:   Fri Jan 10 15:05:10 2025 +0800

    fix file save picker not creating new file
…rosoft/WindowsAppSDK into user/xianghong/storage-pickers-develop
…ototype

Add unit test project for StoragePickers API
…icrosoft/WindowsAppSDK into user/xianghong/storage-pickers-develop
return winrt::hstring{ filePath.get() };
}

std::vector<COMDLG_FILTERSPEC> CaptureFilterSpec(std::vector<winrt::hstring>& buffer, winrt::Windows::Foundation::Collections::IVectorView<winrt::hstring> filters)
Copy link
Collaborator

Choose a reason for hiding this comment

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

buffer

Why pass in this buffer? It looks like parameters.FileTypeFilterData is what gets passed in, which I don't see anything using. Why not have the buffer just be a local, or skip it entirely to directly build result in a single loop?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for your questions.
The buffer and return result are both "out" values. The problem here is the returned Win32 styles COMDLG_FILTERSPEC only contains raw pointers (get from c_str() method of hstrings), which does not automatically expand lifetime of strings dynamically constructed in this function. The buffer is used to carry those strings and is expected to expand lifetime of those string to the lifetime of setting Common Item Dialog options.
Comments has been updated to hopefully reduce confusion on this

Copy link
Collaborator

Choose a reason for hiding this comment

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

Consider changing the CaptureFilterSpec functions to instead be member functions on PickerParameters. Then it doesn't need to take the buffer or return the vector, since it would just use these both locally.

Feel free to consider this for follow-up in a later change.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks @codendone , Now we're refactoring the CaptureFilterSpec methods here #5434

@Hong-Xiang
Copy link
Contributor Author

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@DinahK-2SO
Copy link
Contributor

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@Hong-Xiang
Copy link
Contributor Author

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@Hong-Xiang Hong-Xiang merged commit b75d74e into main Mar 26, 2025
27 checks passed
@Hong-Xiang Hong-Xiang deleted the user/xianghong/storage-pickers-develop branch March 26, 2025 04:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants