UIApplication.Notifications.ObserveProtectedDataDidBecomeAvailable メソッド
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
オーバーロード
ObserveProtectedDataDidBecomeAvailable(NSObject, EventHandler<NSNotificationEventArgs>)
public static Foundation.NSObject ObserveProtectedDataDidBecomeAvailable(Foundation.NSObject objectToObserve, EventHandler<Foundation.NSNotificationEventArgs> handler);
static member ObserveProtectedDataDidBecomeAvailable : Foundation.NSObject * EventHandler<Foundation.NSNotificationEventArgs> -> Foundation.NSObject
パラメーター
- objectToObserve
- NSObject
観察するオブジェクト。
- handler
- EventHandler<NSNotificationEventArgs>
通知が投稿されたときに呼び出すメソッド。
戻り値
通知を破棄するか、 に渡すことによって通知の受信を停止するために使用できる Token オブジェクト RemoveObservers(IEnumerable<NSObject>)
注釈
このメソッドは、 P:UIKit.UIApplication.ProtectedDataDidBecomeAvailableNotification 通知をサブスクライブするために使用できます。
// Listen to all notifications posted for any object
var token = UIApplication.Notifications.ObserveProtectedDataDidBecomeAvailable ((notification) => {
Console.WriteLine ("Observed ProtectedDataDidBecomeAvailableNotification!");
};
// Listen to all notifications posted for a single object
var token = UIApplication.Notifications.ObserveProtectedDataDidBecomeAvailable (objectToObserve, (notification) => {
Console.WriteLine ($"Observed ProtectedDataDidBecomeAvailableNotification for {nameof (objectToObserve)}!");
};
// Stop listening for notifications
token.Dispose ();
適用対象
ObserveProtectedDataDidBecomeAvailable(EventHandler<NSNotificationEventArgs>)
public static Foundation.NSObject ObserveProtectedDataDidBecomeAvailable(EventHandler<Foundation.NSNotificationEventArgs> handler);
static member ObserveProtectedDataDidBecomeAvailable : EventHandler<Foundation.NSNotificationEventArgs> -> Foundation.NSObject
パラメーター
- handler
- EventHandler<NSNotificationEventArgs>
通知が投稿されたときに呼び出すメソッド。
戻り値
通知を破棄するか、 に渡すことによって通知の受信を停止するために使用できる Token オブジェクト RemoveObservers(IEnumerable<NSObject>)
注釈
次の例は、コードでこのメソッドを使用する方法を示しています
//
// Lambda style
//
// listening
notification = UIApplication.Notifications.ObserveProtectedDataDidBecomeAvailable ((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 = UIApplication.Notifications.ObserveProtectedDataDidBecomeAvailable (Callback);
}
void Teardown ()
{
notification.Dispose ();
}