StorageLibraryChangeTrackerOptions Construtor
Definição
Importante
Algumas informações se referem a produtos de pré-lançamento que podem ser substancialmente modificados antes do lançamento. A Microsoft não oferece garantias, expressas ou implícitas, das informações aqui fornecidas.
Construtor para StorageLibraryChangeTrackerOptions a ser usado para configurar o comportamento do rastreador de alterações para um StorageFolder ou StorageLibrary.
public:
StorageLibraryChangeTrackerOptions();
StorageLibraryChangeTrackerOptions();
public StorageLibraryChangeTrackerOptions();
function StorageLibraryChangeTrackerOptions()
Public Sub New ()
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();
}
}
}