NSProcessInfo.PowerStateDidChangeNotification Свойство

Определение

Константа уведомлений для PowerStateDidChange

[Foundation.Advice("Use NSProcessInfo.Notifications.ObservePowerStateDidChange helper method instead.")]
[Foundation.Field("NSProcessInfoPowerStateDidChangeNotification", "Foundation")]
[ObjCRuntime.Introduced(ObjCRuntime.PlatformName.iOS, 9, 0, ObjCRuntime.PlatformArchitecture.All, null)]
public static Foundation.NSString PowerStateDidChangeNotification { [ObjCRuntime.Introduced(ObjCRuntime.PlatformName.iOS, 9, 0, ObjCRuntime.PlatformArchitecture.All, null)] get; }
member this.PowerStateDidChangeNotification : Foundation.NSString

Значение свойства

Константа NSString должна использоваться в качестве маркера для NSNotificationCenter.

Атрибуты

Комментарии

Эту константу можно использовать с для NSNotificationCenter регистрации прослушивателя для этого уведомления. Это NSString вместо строки, так как эти значения могут использоваться в качестве маркеров в некоторых собственных библиотеках, а не только для их фактического содержимого строки. Параметр notification для обратного вызова содержит дополнительные сведения, относящиеся к типу уведомления.

// Lambda style
NSNotificationCenter.DefaultCenter.AddObserver (
        NSProcessInfo.PowerStateDidChangeNotification, (notification) => {Console.WriteLine ("Received the notification NSProcessInfo", notification); }


// Method style
void Callback (NSNotification notification)
{
    Console.WriteLine ("Received a notification NSProcessInfo", notification);
}

void Setup ()
{
    NSNotificationCenter.DefaultCenter.AddObserver (NSProcessInfo.PowerStateDidChangeNotification, Callback);
}

Применяется к