Condividi tramite


Midi.Notifications.ObserveNetworkNotificationContactsDidChange Metodo

Definizione

Overload

ObserveNetworkNotificationContactsDidChange(EventHandler<NSNotificationEventArgs>)

Notifica fortemente tipizzata per la costante P:CoreMidi.Midi.NetworkNotificationContactsDidChangeNotification .

ObserveNetworkNotificationContactsDidChange(NSObject, EventHandler<NSNotificationEventArgs>)

Notifica fortemente tipizzata per la costante P:CoreMidi.Midi.NetworkNotificationContactsDidChangeNotification .

ObserveNetworkNotificationContactsDidChange(EventHandler<NSNotificationEventArgs>)

Notifica fortemente tipizzata per la costante P:CoreMidi.Midi.NetworkNotificationContactsDidChangeNotification .

public static Foundation.NSObject ObserveNetworkNotificationContactsDidChange (EventHandler<Foundation.NSNotificationEventArgs> handler);
static member ObserveNetworkNotificationContactsDidChange : EventHandler<Foundation.NSNotificationEventArgs> -> Foundation.NSObject

Parametri

handler
EventHandler<NSNotificationEventArgs>

Metodo da richiamare quando viene inviata la notifica.

Restituisce

Oggetto token che può essere usato per interrompere 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 = Midi.Notifications.ObserveNetworkNotificationContactsDidChange ((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 = Midi.Notifications.ObserveNetworkNotificationContactsDidChange (Callback);
}

void Teardown ()
{
    notification.Dispose ();
}

Si applica a

ObserveNetworkNotificationContactsDidChange(NSObject, EventHandler<NSNotificationEventArgs>)

Notifica fortemente tipizzata per la costante P:CoreMidi.Midi.NetworkNotificationContactsDidChangeNotification .

public static Foundation.NSObject ObserveNetworkNotificationContactsDidChange (Foundation.NSObject objectToObserve, EventHandler<Foundation.NSNotificationEventArgs> handler);
static member ObserveNetworkNotificationContactsDidChange : Foundation.NSObject * EventHandler<Foundation.NSNotificationEventArgs> -> Foundation.NSObject

Parametri

objectToObserve
NSObject

Oggetto da osservare.

handler
EventHandler<NSNotificationEventArgs>

Metodo da richiamare quando viene inviata la notifica.

Restituisce

Oggetto token che può essere usato per interrompere la ricezione delle notifiche eliminandolo o passandolo a RemoveObservers(IEnumerable<NSObject>)

Commenti

Questo metodo può essere usato per sottoscrivere le notifiche P:CoreMidi.Midi.NetworkNotificationContactsDidChangeNotification .

// Listen to all notifications posted for any object
var token = Midi.Notifications.ObserveNetworkNotificationContactsDidChange ((notification) => {
	Console.WriteLine ("Observed NetworkNotificationContactsDidChangeNotification!");
};

// Listen to all notifications posted for a single object
var token = Midi.Notifications.ObserveNetworkNotificationContactsDidChange (objectToObserve, (notification) => {
	Console.WriteLine ($"Observed NetworkNotificationContactsDidChangeNotification for {nameof (objectToObserve)}!");
};

// Stop listening for notifications
token.Dispose ();

Si applica a