ApplicationData.DataChanged Kejadian
Definisi
Penting
Beberapa informasi terkait produk prarilis yang dapat diubah secara signifikan sebelum dirilis. Microsoft tidak memberikan jaminan, tersirat maupun tersurat, sehubungan dengan informasi yang diberikan di sini.
Terjadi saat data aplikasi roaming disinkronkan.
// Register
event_token DataChanged(TypedEventHandler<ApplicationData, IInspectable const&> const& handler) const;
// Revoke with event_token
void DataChanged(event_token const* cookie) const;
// Revoke with event_revoker
ApplicationData::DataChanged_revoker DataChanged(auto_revoke_t, TypedEventHandler<ApplicationData, IInspectable const&> const& handler) const;
public event TypedEventHandler<ApplicationData,object> DataChanged;
function onDataChanged(eventArgs) { /* Your code */ }
applicationData.addEventListener("datachanged", onDataChanged);
applicationData.removeEventListener("datachanged", onDataChanged);
- or -
applicationData.ondatachanged = onDataChanged;
Public Custom Event DataChanged As TypedEventHandler(Of ApplicationData, Object)
Jenis Acara
TypedEventHandler<ApplicationData,IInspectable>
Contoh
Contoh ini mendaftar untuk peristiwa DataChanged.
void InitHandlers()
{
Windows.Storage.ApplicationData.Current.DataChanged +=
new TypedEventHandler<ApplicationData, object>(DataChangeHandler);
}
void DataChangeHandler(Windows.Storage.ApplicationData appData, object o)
{
// TODO: Refresh your data
}
void MainPage::InitHandlers()
{
Windows::Storage::ApplicationData::Current().DataChanged({ this, &MainPage::DataChangeHandler });
}
void MainPage::DataChangeHandler(Windows::Storage::ApplicationData const& /* appData */, Windows::Foundation::IInspectable const& /* object */)
{
// TODO: Refresh your data.
}
void MainPage::InitHandlers()
{
Windows::Storage::ApplicationData::Current->DataChanged +=
ref new TypedEventHandler<Windows::Storage::ApplicationData^, Object^>
(this, &MainPage::DataChangeHandler);
}
void MainPage::DataChangeHandler(Windows::Storage::ApplicationData^ appData, Object^)
{
// TODO: Refresh your data
}
Private Sub InitHandlers()
AddHandler Windows.Storage.ApplicationData.Current.DataChanged, AddressOf DataChangeHandler
End Sub
Private Sub DataChangeHandler(ByVal appData As Windows.Storage.ApplicationData, ByVal o As Object)
' TODO: Refresh your data
End Sub
Keterangan
Penanganan aktivitas menerima objek ApplicationData yang menyediakan akses ke kontainer data roaming yang diubah. Untuk informasi selengkapnya, lihat Data roaming.