Share via


NSProcessInfo.Notifications.ObserveThermalStateDidChange Método

Definición

Sobrecargas

ObserveThermalStateDidChange(EventHandler<NSNotificationEventArgs>)

Notificación fuertemente tipada para la ThermalStateDidChangeNotification constante.

ObserveThermalStateDidChange(NSObject, EventHandler<NSNotificationEventArgs>)

Notificación fuertemente tipada para la ThermalStateDidChangeNotification constante.

ObserveThermalStateDidChange(EventHandler<NSNotificationEventArgs>)

Notificación fuertemente tipada para la ThermalStateDidChangeNotification constante.

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

Parámetros

handler
EventHandler<NSNotificationEventArgs>

Método que se invoca cuando se publica la notificación.

Devoluciones

Objeto token que se puede usar para dejar de recibir notificaciones mediante su eliminación o su paso a RemoveObservers(IEnumerable<NSObject>)

Comentarios

Este método se puede usar para suscribirse ThermalStateDidChangeNotification a las notificaciones.

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

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

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

Se aplica a

ObserveThermalStateDidChange(NSObject, EventHandler<NSNotificationEventArgs>)

Notificación fuertemente tipada para la ThermalStateDidChangeNotification constante.

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

Parámetros

objectToObserve
NSObject

Objeto que se va a observar.

handler
EventHandler<NSNotificationEventArgs>

Método que se invoca cuando se publica la notificación.

Devoluciones

Objeto token que se puede usar para dejar de recibir notificaciones mediante su eliminación o su paso a RemoveObservers(IEnumerable<NSObject>)

Comentarios

Este método se puede usar para suscribirse ThermalStateDidChangeNotification a las notificaciones.

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

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

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

Se aplica a