Creating the custom UI objects

Jump back in the Camera project and let's begin adding a new folder called Controls. Add in a new file called OrientationPage.cs and implement the following:

public class OrientationPage : ContentPage 
    { 
        #region Static Properties 
 
        public static Orientation PageOrientation; 
 
        public static event EventHandler<Orientation> OrientationHandler; 
 
        public static event EventHandler<Point> TouchHandler; 
 
        #endregion 
 
        #region Static Methods 
 
        public static void NotifyOrientationChange(Orientation orientation) 
        { 
            if (OrientationHandler != null) 
            { 
                OrientationHandler (null, orientation); 
            } 
        } 
 
        public static void NotifyTouch(Point touchPoint) 
        { 
            if (TouchHandler != null) 
            { 
                TouchHandler(null, touchPoint); 
            } 
        } 
 
        #endregion 
    } 

In our previous chapter, ...

Get Xamarin Blueprints now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.