Compartir a través de


UIApplication.Notifications.ObserveDidFinishLaunching Método

Definición

Sobrecargas

ObserveDidFinishLaunching(EventHandler<UIApplicationLaunchEventArgs>)

Notificación fuertemente tipada para la DidFinishLaunchingNotification constante.

ObserveDidFinishLaunching(NSObject, EventHandler<UIApplicationLaunchEventArgs>)

Notificación fuertemente tipada para la DidFinishLaunchingNotification constante.

ObserveDidFinishLaunching(EventHandler<UIApplicationLaunchEventArgs>)

Notificación fuertemente tipada para la DidFinishLaunchingNotification constante.

public static Foundation.NSObject ObserveDidFinishLaunching (EventHandler<UIKit.UIApplicationLaunchEventArgs> handler);
static member ObserveDidFinishLaunching : EventHandler<UIKit.UIApplicationLaunchEventArgs> -> Foundation.NSObject

Parámetros

handler
EventHandler<UIApplicationLaunchEventArgs>

Método para invocar cuando se publica la notificación.

Devoluciones

Objeto de token que se puede usar para dejar de recibir notificaciones al eliminarlo o pasarlo a RemoveObservers(IEnumerable<NSObject>)

Comentarios

En el ejemplo siguiente se muestra cómo los desarrolladores pueden usar este método en su código:

//
// Lambda style
//

// listening
notification = UIApplication.Notifications.ObserveDidFinishLaunching ((sender, args) => {
    /* Access strongly typed args */
    Console.WriteLine ("Notification: {0}", args.Notification);

    Console.WriteLine ("Url", args.Url);
    Console.WriteLine ("SourceApplication", args.SourceApplication);
    Console.WriteLine ("RemoteNotifications", args.RemoteNotifications);
    Console.WriteLine ("LocationLaunch", args.LocationLaunch);
});

// To stop listening:
notification.Dispose ();

//
//Method style
//
NSObject notification;
void Callback (object sender, UIKit.UIApplicationLaunchEventArgs args)
{
    // Access strongly typed args
    Console.WriteLine ("Notification: {0}", args.Notification);

    Console.WriteLine ("Url", args.Url);
    Console.WriteLine ("SourceApplication", args.SourceApplication);
    Console.WriteLine ("RemoteNotifications", args.RemoteNotifications);
    Console.WriteLine ("LocationLaunch", args.LocationLaunch);
}

void Setup ()
{
    notification = UIApplication.Notifications.ObserveDidFinishLaunching (Callback);
}

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

Se aplica a

ObserveDidFinishLaunching(NSObject, EventHandler<UIApplicationLaunchEventArgs>)

Notificación fuertemente tipada para la DidFinishLaunchingNotification constante.

public static Foundation.NSObject ObserveDidFinishLaunching (Foundation.NSObject objectToObserve, EventHandler<UIKit.UIApplicationLaunchEventArgs> handler);
static member ObserveDidFinishLaunching : Foundation.NSObject * EventHandler<UIKit.UIApplicationLaunchEventArgs> -> Foundation.NSObject

Parámetros

objectToObserve
NSObject

Objeto que se va a observar.

handler
EventHandler<UIApplicationLaunchEventArgs>

Método para invocar cuando se publica la notificación.

Devoluciones

Objeto de token que se puede usar para dejar de recibir notificaciones al eliminarlo o pasarlo a RemoveObservers(IEnumerable<NSObject>)

Comentarios

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

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

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

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

Se aplica a