IStorageProviderKnownFolderSyncInfoSource.GetKnownFolderSyncInfo 方法

定义

每当需要从云提供商获取最新的已知文件夹同步状态时,文件资源管理器将调用 GetKnownFolderSyncInfo

public:
 StorageProviderKnownFolderSyncInfo ^ GetKnownFolderSyncInfo();
StorageProviderKnownFolderSyncInfo GetKnownFolderSyncInfo();
public StorageProviderKnownFolderSyncInfo GetKnownFolderSyncInfo();
function getKnownFolderSyncInfo()
Public Function GetKnownFolderSyncInfo () As StorageProviderKnownFolderSyncInfo

返回

返回一个 StorageProviderKnownFolderSyncInfo 对象,该对象包含最新的已知文件夹同步状态。

示例

以下示例演示如何在云提供程序中实现 GetKnownFolderSyncInfo

StorageProviderKnownFolderSyncInfo MyKnownFolderInfoSource::GetKnownFolderSyncInfo()
{
    winrt::StorageProviderKnownFolderSyncInfo info{};
    info.ProviderDisplayName(GetProviderDisplayName());

    // Setting a SyncRequested handler to respond to user action.
    auto syncRequestHandler = [](
    winrt::CloudMirror::StorageProviderKnownFolderSyncRequestArgs const& args)
    {
        // The user wants to sync some known folders with our cloud provider.
        // We can show some UI to sign in, confirm their choice, etc.
        MyStorageProviderSyncManager::ShowFolderEnrollmentUI(args.KnownFolders(), args.Source());

        // Or we can immediately start syncing the requested folders.
        MyStorageProviderSyncManager::StartSyncingFolders(args.KnownFolders(), args.Source());
    };

    info.SyncRequested(syncRequestHandler);
    info.KnownFolderEntries().ReplaceAll(m_knownFolderEntries);

    return info;
}

注解

返回后, StorageProviderKnownFolderSyncInfo 被视为不可变。

必须在返回的对象上设置 SyncRequested 处理程序,才能被视为有效并显示在文件资源管理器中。

适用于

另请参阅