Condividi tramite


StorageLibraryChangeTrackerOptions.TrackChangeDetails Proprietà

Definizione

Usato per determinare se il sistema tiene traccia di ogni singola modifica o solo dell'ultimo ID modifica per un determinato indicatore di modifica.

public:
 property bool TrackChangeDetails { bool get(); void set(bool value); };
bool TrackChangeDetails();

void TrackChangeDetails(bool value);
public bool TrackChangeDetails { get; set; }
var boolean = storageLibraryChangeTrackerOptions.trackChangeDetails;
storageLibraryChangeTrackerOptions.trackChangeDetails = boolean;
Public Property TrackChangeDetails As Boolean

Valore della proprietà

Boolean

bool

Valore booleano che determina se il rilevamento modifiche deve tenere traccia di tutti i dettagli delle modifiche o solo dell'ultimo ID modifica. Se non è impostata o modificata, questa impostazione predefinita viene impostata su true.

Esempio

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

Commenti

TrackChangeDetails è true per impostazione predefinita per tutti i tracker delle modifiche. È possibile impostare questo valore su false quando viene passato a StorageLibraryChangeTracker::EnableWithOptions per salvare nell'archiviazione di sistema se l'applicazione è preoccupata solo per l'ultimo ID modifica e non per i dettagli su ogni singola modifica.

Si applica a

Vedi anche