UIApplication.Notifications.ObserveDidFinishLaunching UIApplication.Notifications.ObserveDidFinishLaunching Method

Definition

Overloads

ObserveDidFinishLaunching(EventHandler<UIApplicationLaunchEventArgs>) ObserveDidFinishLaunching(EventHandler<UIApplicationLaunchEventArgs>)

Strongly typed notification for the DidFinishLaunchingNotification constant.

ObserveDidFinishLaunching(NSObject, EventHandler<UIApplicationLaunchEventArgs>) ObserveDidFinishLaunching(NSObject, EventHandler<UIApplicationLaunchEventArgs>)

Strongly typed notification for the DidFinishLaunchingNotification constant.

ObserveDidFinishLaunching(EventHandler<UIApplicationLaunchEventArgs>) ObserveDidFinishLaunching(EventHandler<UIApplicationLaunchEventArgs>)

Strongly typed notification for the DidFinishLaunchingNotification constant.

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

Parameters

handler
EventHandler<UIApplicationLaunchEventArgs>

Method to invoke when the notification is posted.

Returns

Token object that can be used to stop receiving notifications by either disposing it or passing it to RemoveObservers(IEnumerable<NSObject>)

Remarks

The following example shows how developers can use this method in their code:


//
// 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 (); }

ObserveDidFinishLaunching(NSObject, EventHandler<UIApplicationLaunchEventArgs>) ObserveDidFinishLaunching(NSObject, EventHandler<UIApplicationLaunchEventArgs>)

Strongly typed notification for the DidFinishLaunchingNotification constant.

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

Parameters

objectToObserve
NSObject NSObject

The object to observe.

handler
EventHandler<UIApplicationLaunchEventArgs>

Method to invoke when the notification is posted.

Returns

Token object that can be used to stop receiving notifications by either disposing it or passing it to RemoveObservers(IEnumerable<NSObject>)

Remarks

This method can be used to subscribe for DidFinishLaunchingNotification notifications.


// 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 ();

Applies to