StorageLibraryChangeTracker.Disable Metode

Definisi

Menonaktifkan pelacakan perubahan untuk StorageFolder atau StorageLibrary.

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

Persyaratan Windows

Rangkaian perangkat
Windows 10, version 2104 (diperkenalkan dalam 10.0.20348.0)
API contract
Windows.Foundation.UniversalApiContract (diperkenalkan dalam v12.0)

Contoh

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

Keterangan

Metode ini tidak akan melakukan apa pun jika aplikasi panggilan belum disebut Aktifkan pada StorageFolder/StorageLibrary.

Berlaku untuk

Lihat juga