共用方式為


StorageLibraryChangeTrackerOptions.TrackChangeDetails 屬性

定義

用來判斷系統是否會追蹤每個個別變更,或只追蹤指定變更追蹤器的最後一個變更識別碼。

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

屬性值

Boolean

bool

布林值,決定變更追蹤器是否應該追蹤所有變更詳細資料,或只追蹤最後一個變更識別碼。如果未設定或修改,這會預設為 true。

範例

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

備註

TrackChangeDetails 預設為所有變更追蹤器為 true。 當傳遞至 StorageLibraryChangeTracker::EnableWithOptions 時,您可以將此設定為 false,以便在應用程式只擔心上次變更識別碼,而不是每個個別變更的詳細資料時儲存系統儲存體。

適用於

另請參閱