Dela via


AppointmentStore.GetChangeTracker(String) Method

Definition

Gets a AppointmentStoreChangeTracker that provides functionality for monitoring changes to Appointment objects in the AppointmentStore.

public:
 virtual AppointmentStoreChangeTracker ^ GetChangeTracker(Platform::String ^ identity) = GetChangeTracker;
AppointmentStoreChangeTracker GetChangeTracker(winrt::hstring const& identity);
public AppointmentStoreChangeTracker GetChangeTracker(string identity);
function getChangeTracker(identity)
Public Function GetChangeTracker (identity As String) As AppointmentStoreChangeTracker

Parameters

identity
String

Platform::String

winrt::hstring

A string that identifies the AppointmentStoreChangeTracker instance in the store.

Returns

A AppointmentStoreChangeTracker that provides functionality for monitoring changes to Appointment objects in the AppointmentStore.

Windows requirements

Device family
Windows 10 Fall Creators Update (introduced in 10.0.16299.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v5.0)
App capabilities
appointmentsSystem

Examples

This example uses a named change tracker to update an application's dashboard with appointment information.

private async Task UpdateDashboard(AppointmentStore store)
{
    AppointmentStoreChangeTracker tracker = store.GetChangeTracker("DashboardUpdater");

    // Check to see if we were already tracking. If not then we don't know
    // what changed and we should update everything.
    if (!tracker.IsTracking)
    {
        tracker.Enable();
        UpdateFullDashboard();

        // Don't return yet. We still want to process any changes which
        // happened while we were updating the dashboard.
    }

    // check for changes
    IReadOnlyList<AppointmentStoreChange> changes;
    do
    {
        changes = await tracker.GetChangeReader().ReadBatchAsync();
        foreach (AppointmentStoreChange change in changes)
        {
            UpdateDashboardWidget(change);
        }
    } while (changes.Count > 0);
}

Remarks

You can create multiple AppointmentStoreChangeTracker instances by using this method. If you pass in a string that identifies a AppointmentStoreChangeTracker that already exists in the store, this method returns that instance. If the string that you pass into this method does not identify an existing an existing AppointmentStoreChangeTracker, this method returns a new AppointmentStoreChangeTracker.

You can use the IsTracking property of the AppointmentStoreChangeTracker to determine whether change tracking is enabled for the AppointmentStoreChangeTracker.

Applies to