MPMoviePlayerController.Notifications.ObserveWillExitFullscreen Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
ObserveWillExitFullscreen(EventHandler<MPMoviePlayerFullScreenEventArgs>) |
Strongly typed notification for the WillExitFullscreenNotification constant. |
ObserveWillExitFullscreen(NSObject, EventHandler<MPMoviePlayerFullScreenEventArgs>) |
Strongly typed notification for the WillExitFullscreenNotification constant. |
ObserveWillExitFullscreen(EventHandler<MPMoviePlayerFullScreenEventArgs>)
Strongly typed notification for the WillExitFullscreenNotification constant.
public static Foundation.NSObject ObserveWillExitFullscreen (EventHandler<MediaPlayer.MPMoviePlayerFullScreenEventArgs> handler);
static member ObserveWillExitFullscreen : EventHandler<MediaPlayer.MPMoviePlayerFullScreenEventArgs> -> Foundation.NSObject
Parameters
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 = MPMoviePlayerController.Notifications.ObserveWillExitFullscreen ((sender, args) => {
/* Access strongly typed args */
Console.WriteLine ("Notification: {0}", args.Notification);
Console.WriteLine ("AnimationDuration", args.AnimationDuration);
Console.WriteLine ("AnimationCurve", args.AnimationCurve);
});
// To stop listening:
notification.Dispose ();
//
//Method style
//
NSObject notification;
void Callback (object sender, MediaPlayer.MPMoviePlayerFullScreenEventArgs args)
{
// Access strongly typed args
Console.WriteLine ("Notification: {0}", args.Notification);
Console.WriteLine ("AnimationDuration", args.AnimationDuration);
Console.WriteLine ("AnimationCurve", args.AnimationCurve);
}
void Setup ()
{
notification = MPMoviePlayerController.Notifications.ObserveWillExitFullscreen (Callback);
}
void Teardown ()
{
notification.Dispose ();
}
Applies to
ObserveWillExitFullscreen(NSObject, EventHandler<MPMoviePlayerFullScreenEventArgs>)
Strongly typed notification for the WillExitFullscreenNotification constant.
public static Foundation.NSObject ObserveWillExitFullscreen (Foundation.NSObject objectToObserve, EventHandler<MediaPlayer.MPMoviePlayerFullScreenEventArgs> handler);
static member ObserveWillExitFullscreen : Foundation.NSObject * EventHandler<MediaPlayer.MPMoviePlayerFullScreenEventArgs> -> Foundation.NSObject
Parameters
- objectToObserve
- NSObject
The object to observe.
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 WillExitFullscreenNotification notifications.
// Listen to all notifications posted for any object
var token = MPMoviePlayerController.Notifications.ObserveWillExitFullscreen ((notification) => {
Console.WriteLine ("Observed WillExitFullscreenNotification!");
};
// Listen to all notifications posted for a single object
var token = MPMoviePlayerController.Notifications.ObserveWillExitFullscreen (objectToObserve, (notification) => {
Console.WriteLine ($"Observed WillExitFullscreenNotification for {nameof (objectToObserve)}!");
};
// Stop listening for notifications
token.Dispose ();