ALAssetsLibrary.Notifications.ObserveChanged Metodo
Definizione
Importante
Alcune informazioni sono relative alla release non definitiva del prodotto, che potrebbe subire modifiche significative prima della release definitiva. Microsoft non riconosce alcuna garanzia, espressa o implicita, in merito alle informazioni qui fornite.
Overload
ObserveChanged(EventHandler<ALAssetLibraryChangedEventArgs>) |
Notifica fortemente tipizzata per la ChangedNotification costante. |
ObserveChanged(EventHandler<NSNotificationEventArgs>) |
Notifica fortemente tipizzata per la ChangedNotification costante. |
ObserveChanged(NSObject, EventHandler<ALAssetLibraryChangedEventArgs>) |
Notifica fortemente tipizzata per la ChangedNotification costante. |
ObserveChanged(NSObject, EventHandler<NSNotificationEventArgs>) |
Notifica fortemente tipizzata per la ChangedNotification costante. |
ObserveChanged(EventHandler<ALAssetLibraryChangedEventArgs>)
Notifica fortemente tipizzata per la ChangedNotification costante.
public static Foundation.NSObject ObserveChanged (EventHandler<AssetsLibrary.ALAssetLibraryChangedEventArgs> handler);
static member ObserveChanged : EventHandler<AssetsLibrary.ALAssetLibraryChangedEventArgs> -> Foundation.NSObject
Parametri
Metodo da richiamare quando viene pubblicata la notifica.
Restituisce
Oggetto token che può essere usato per arrestare la ricezione delle notifiche eliminandolo o passandolo a RemoveObservers(IEnumerable<NSObject>)
Commenti
Nell'esempio seguente viene illustrato come usare questo metodo nel codice
//
// Lambda style
//
// listening
notification = ALAssetsLibrary.Notifications.ObserveChanged ((sender, args) => {
/* Access strongly typed args */
Console.WriteLine ("Notification: {0}", args.Notification);
Console.WriteLine ("UpdatedAssets", args.UpdatedAssets);
Console.WriteLine ("InsertedAssetGroups", args.InsertedAssetGroups);
Console.WriteLine ("UpdatedAssetGroups", args.UpdatedAssetGroups);
Console.WriteLine ("DeletedAssetGroupsKey", args.DeletedAssetGroupsKey);
});
// To stop listening:
notification.Dispose ();
//
//Method style
//
NSObject notification;
void Callback (object sender, AssetsLibrary.ALAssetLibraryChangedEventArgs args)
{
// Access strongly typed args
Console.WriteLine ("Notification: {0}", args.Notification);
Console.WriteLine ("UpdatedAssets", args.UpdatedAssets);
Console.WriteLine ("InsertedAssetGroups", args.InsertedAssetGroups);
Console.WriteLine ("UpdatedAssetGroups", args.UpdatedAssetGroups);
Console.WriteLine ("DeletedAssetGroupsKey", args.DeletedAssetGroupsKey);
}
void Setup ()
{
notification = ALAssetsLibrary.Notifications.ObserveChanged (Callback);
}
void Teardown ()
{
notification.Dispose ();
}
Si applica a
ObserveChanged(EventHandler<NSNotificationEventArgs>)
Notifica fortemente tipizzata per la ChangedNotification costante.
public static Foundation.NSObject ObserveChanged (EventHandler<Foundation.NSNotificationEventArgs> handler);
static member ObserveChanged : EventHandler<Foundation.NSNotificationEventArgs> -> Foundation.NSObject
Parametri
- handler
- EventHandler<NSNotificationEventArgs>
Metodo da richiamare quando viene pubblicata la notifica.
Restituisce
Oggetto token che può essere usato per arrestare la ricezione delle notifiche eliminandolo o passandolo a RemoveObservers(IEnumerable<NSObject>)
Commenti
Nell'esempio seguente viene illustrato come usare questo metodo nel codice
//
// Lambda style
//
// listening
notification = ALAssetsLibrary.Notifications.ObserveChanged ((sender, args) => {
/* Access strongly typed args */
Console.WriteLine ("Notification: {0}", args.Notification);
});
// To stop listening:
notification.Dispose ();
//
//Method style
//
NSObject notification;
void Callback (object sender, Foundation.NSNotificationEventArgs args)
{
// Access strongly typed args
Console.WriteLine ("Notification: {0}", args.Notification);
}
void Setup ()
{
notification = ALAssetsLibrary.Notifications.ObserveChanged (Callback);
}
void Teardown ()
{
notification.Dispose ();
}
Si applica a
ObserveChanged(NSObject, EventHandler<ALAssetLibraryChangedEventArgs>)
Notifica fortemente tipizzata per la ChangedNotification costante.
public static Foundation.NSObject ObserveChanged (Foundation.NSObject objectToObserve, EventHandler<AssetsLibrary.ALAssetLibraryChangedEventArgs> handler);
static member ObserveChanged : Foundation.NSObject * EventHandler<AssetsLibrary.ALAssetLibraryChangedEventArgs> -> Foundation.NSObject
Parametri
- objectToObserve
- NSObject
Oggetto da osservare.
Metodo da richiamare quando viene pubblicata la notifica.
Restituisce
Oggetto token che può essere usato per arrestare la ricezione delle notifiche eliminandolo o passandolo a RemoveObservers(IEnumerable<NSObject>)
Commenti
Questo metodo può essere usato per sottoscrivere ChangedNotification le notifiche.
// Listen to all notifications posted for any object
var token = ALAssetsLibrary.Notifications.ObserveChanged ((notification) => {
Console.WriteLine ("Observed ChangedNotification!");
};
// Listen to all notifications posted for a single object
var token = ALAssetsLibrary.Notifications.ObserveChanged (objectToObserve, (notification) => {
Console.WriteLine ($"Observed ChangedNotification for {nameof (objectToObserve)}!");
};
// Stop listening for notifications
token.Dispose ();
Si applica a
ObserveChanged(NSObject, EventHandler<NSNotificationEventArgs>)
Notifica fortemente tipizzata per la ChangedNotification costante.
public static Foundation.NSObject ObserveChanged (Foundation.NSObject objectToObserve, EventHandler<Foundation.NSNotificationEventArgs> handler);
static member ObserveChanged : Foundation.NSObject * EventHandler<Foundation.NSNotificationEventArgs> -> Foundation.NSObject
Parametri
- objectToObserve
- NSObject
Oggetto da osservare.
- handler
- EventHandler<NSNotificationEventArgs>
Metodo da richiamare quando viene pubblicata la notifica.
Restituisce
Oggetto token che può essere usato per arrestare la ricezione delle notifiche eliminandolo o passandolo a RemoveObservers(IEnumerable<NSObject>)
Commenti
Questo metodo può essere usato per sottoscrivere ChangedNotification le notifiche.
// Listen to all notifications posted for any object
var token = ALAssetsLibrary.Notifications.ObserveChanged ((notification) => {
Console.WriteLine ("Observed ChangedNotification!");
};
// Listen to all notifications posted for a single object
var token = ALAssetsLibrary.Notifications.ObserveChanged (objectToObserve, (notification) => {
Console.WriteLine ($"Observed ChangedNotification for {nameof (objectToObserve)}!");
};
// Stop listening for notifications
token.Dispose ();