-
Notifications
You must be signed in to change notification settings - Fork 391
New properties in Storage.Pickers - SuggestedDefaultFolder, SuggestedFolder, FileTypeChoices #5772
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Copyright (c) Microsoft Corporation and Contributors. | ||
// Licensed under the MIT License. | ||
|
||
// THIS FILE IS AUTOMATICALLY GENERATED; DO NOT EDIT IT | ||
|
||
// INPUT FILE: dev\Common\TerminalVelocityFeatures-StoragePickers2.xml | ||
// OPTIONS: -Channel Experimental -Language C++ -Namespace Microsoft.Windows.Storage.Pickers -Path dev\Common\TerminalVelocityFeatures-StoragePickers2.xml -Output dev\Common\TerminalVelocityFeatures-StoragePickers2.h | ||
|
||
#if defined(__midlrt) | ||
namespace features | ||
{ | ||
feature_name Feature_StoragePickers2 = { DisabledByDefault, FALSE }; | ||
} | ||
#endif // defined(__midlrt) | ||
|
||
// Feature constants | ||
#define WINDOWSAPPRUNTIME_MICROSOFT_WINDOWS_STORAGE_PICKERS_FEATURE_STORAGEPICKERS2_ENABLED 1 | ||
|
||
#if defined(__cplusplus) | ||
|
||
namespace Microsoft::Windows::Storage::Pickers | ||
{ | ||
|
||
__pragma(detect_mismatch("ODR_violation_WINDOWSAPPRUNTIME_MICROSOFT_WINDOWS_STORAGE_PICKERS_FEATURE_STORAGEPICKERS2_ENABLED_mismatch", "AlwaysEnabled")) | ||
struct Feature_StoragePickers2 | ||
{ | ||
static constexpr bool IsEnabled() { return WINDOWSAPPRUNTIME_MICROSOFT_WINDOWS_STORAGE_PICKERS_FEATURE_STORAGEPICKERS2_ENABLED == 1; } | ||
}; | ||
|
||
} // namespace Microsoft.Windows.Storage.Pickers | ||
|
||
#endif // defined(__cplusplus) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?xml version="1.0"?> | ||
<features xmlns="http://microsoft.com/windowsappsdk/TerminalVelocity/20210729/TerminalVelocityFeatures.xsd"> | ||
|
||
<!-- Copyright (c) Microsoft Corporation. All rights reserved. | ||
Licensed under the MIT License. See LICENSE in the project root for license information. | ||
--> | ||
|
||
<!-- See docs/Coding-Guidelines/TerminalVelocity.md for more info. --> | ||
|
||
<!-- Enabled variants --> | ||
<feature> | ||
<name>Feature_StoragePickers2</name> | ||
<description>New functionalities in StoragePickers for the WindowsAppRuntime: SuggestedDefaultFolder, FileTypeChoices</description> | ||
<state>AlwaysEnabled</state> | ||
<alwaysDisabledChannelTokens> | ||
<channelToken>Preview</channelToken> | ||
<channelToken>Stable</channelToken> | ||
</alwaysDisabledChannelTokens> | ||
</feature> | ||
</features> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,6 +29,9 @@ namespace winrt::Microsoft::Windows::Storage::Pickers::implementation | |
hstring SuggestedFolder(); | ||
void SuggestedFolder(hstring const& value); | ||
|
||
hstring SuggestedStartFolder(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit - Is there a possibility to move common logic to a base class? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks, this is a good point. We might do some refactoring in future. |
||
void SuggestedStartFolder(hstring const& value); | ||
|
||
hstring SuggestedFileName(); | ||
void SuggestedFileName(hstring const& value); | ||
|
||
|
@@ -41,6 +44,7 @@ namespace winrt::Microsoft::Windows::Storage::Pickers::implementation | |
winrt::Windows::Foundation::Collections::IMap<hstring, winrt::Windows::Foundation::Collections::IVector<hstring>> m_fileTypeChoices{ make<FileTypeChoicesMap>() }; | ||
hstring m_defaultFileExtension{}; | ||
hstring m_suggestedFolder{}; | ||
hstring m_suggestedStartFolder{}; | ||
hstring m_suggestedFileName{}; | ||
StoragePickersTelemetryHelper m_telemetryHelper{}; | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,8 @@ namespace winrt::Microsoft::Windows::Storage::Pickers::implementation | |
{ | ||
FileTypeChoicesMap(); | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Curiosity - Can you explain the rationale behind this update? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, this is for velocity. The FileSavePicker already has FileTypeChoices, so it doesn't need an velocity check. In future when we remove this velocity, we can remove the forSavePicker flag too. |
||
bool ForFeature_StoragePickers2{ false }; | ||
|
||
// IMap<hstring, IVector<hstring>> | ||
winrt::Windows::Foundation::Collections::IVector<hstring> Lookup(hstring const& key) const; | ||
uint32_t Size() const; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Curiosity: Maybe it might be worthwhile to test performance as well? Could complex or large FileTypeChoices lists slow down picker init?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be ok. It is the same property logic existing in FileSavePicker.