Condividi tramite


AppointmentStore.GetChangeTracker(String) Metodo

Definizione

Ottiene un AppointmentStoreChangeTracker che fornisce funzionalità per il monitoraggio delle modifiche apportate agli oggetti Appointment in 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

Parametri

identity
String

Platform::String

winrt::hstring

Stringa che identifica l'istanza appointmentStoreChangeTracker nell'archivio.

Restituisce

AppointmentStoreChangeTracker che fornisce funzionalità per il monitoraggio delle modifiche apportate agli oggetti Appointment in AppointmentStore.

Requisiti Windows

Famiglia di dispositivi
Windows 10 Fall Creators Update (è stato introdotto in 10.0.16299.0)
API contract
Windows.Foundation.UniversalApiContract (è stato introdotto in v5.0)
Funzionalità dell'app
appointmentsSystem

Esempio

In questo esempio viene usato un rilevatore di modifiche denominato per aggiornare il dashboard di un'applicazione con le informazioni sull'appuntamento.

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

Commenti

È possibile creare più istanze di AppointmentStoreChangeTracker usando questo metodo. Se si passa una stringa che identifica un AppointmentStoreChangeTracker già esistente nell'archivio, questo metodo restituisce tale istanza. Se la stringa passata in questo metodo non identifica un esistente AppointmentStoreChangeTracker, questo metodo restituisce un nuovo AppointmentStoreChangeTracker.

È possibile utilizzare la proprietà IsTracking di AppointmentStoreChangeTracker per determinare se il rilevamento delle modifiche è abilitato per AppointmentStoreChangeTracker.

Si applica a