StorageLibraryLastChangeId Clase

Definición

Permite realizar un seguimiento de los cambios en función de un valor único que represente el último cambio procesado por el servicio de indexación para storageFolder o StorageLibrary especificados.

public ref class StorageLibraryLastChangeId sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 720896)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class StorageLibraryLastChangeId final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 720896)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class StorageLibraryLastChangeId
Public NotInheritable Class StorageLibraryLastChangeId
Herencia
Object Platform::Object IInspectable StorageLibraryLastChangeId
Atributos

Requisitos de Windows

Familia de dispositivos
Windows 10, version 2104 (se introdujo en la versión 10.0.20348.0)
API contract
Windows.Foundation.UniversalApiContract (se introdujo en la versión v12.0)

Ejemplos

// 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();
    }
}
}

Propiedades

Unknown

Se devuelve cuando el diario usn se desborda y el servicio no puede mantenerse al día con los cambios o hay otra razón por la que no se puede calcular el identificador de cambio.

Se aplica a

Consulte también