Compartilhar via


StorageLibraryChangeTracker.Disable Método

Definição

Desabilita o controle de alterações para StorageFolder ou StorageLibrary.

public:
 virtual void Disable() = Disable;
void Disable();
public void Disable();
function disable()
Public Sub Disable ()

Requisitos do Windows

Família de dispositivos
Windows 10, version 2104 (introduzida na 10.0.20348.0)
API contract
Windows.Foundation.UniversalApiContract (introduzida na v12.0)

Exemplos

// applications are expected to persist the previous value
UINT64 appsLastPersistedChangeId = StorageLibraryLastChangeId::Unknown();
StorageFolder folder = StorageFolder::GetFolderFromPathAsync(L"my folder path").get();

StorageLibraryChangeTracker tracker = folder.TryGetChangeTracker();
if (tracker != nullptr)
{
StorageLibraryChangeTrackerOptions ops;
ops.TrackChangeDetails(false);
tracker.Enable(ops);

StorageLibraryChangeReader reader = tracker.GetChangeReader();
if (reader != nullptr)
{
    UINT32 changeId = reader.GetLastChangeId();
    if ((changeId == StorageLibraryLastChangeId::Unknown())
    {
        ScanFolderSlow();
    }
    else if (changeId == 0)
    {
        // no changes in the storage folder yet, OR nothing has changed
        ProcessNormalApplicationStartup();
    }
    else if (changeId != appsLastPersistedChangeId)
    {
        // There have been new changes since we’ve last ran, process them
        appsLastPersistedChangeId = changeId;
        ScanFolderForChanges();
    }
    else
    {
        // changeId and our last persisted change id match, also normal application startup
        ProcessNormalApplicationStartup();
    }
}
}

Comentários

Esse método não fará nada se o aplicativo de chamada ainda não tiver chamado Habilitar no StorageFolder/StorageLibrary.

Aplica-se a

Confira também