protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); Xamarin.Essentials.Platform.Init(this, bundle); global::Xamarin.Forms.Forms.Init(this, bundle); LoadApplication((mBarcodeReaderSampleApp = new BarcodeReaderSample.App())); mMainPage = (BarcodeReaderSample.MainPage)mBarcodeReaderSampleApp.MainPage; //lock application orientation ScreenLayout screenSize = Application.Context.ApplicationContext.Resources.Configuration.ScreenLayout & ScreenLayout.SizeMask; switch (screenSize) { case ScreenLayout.SizeXlarge: case ScreenLayout.SizeLarge: this.RequestedOrientation = ScreenOrientation.Landscape; break; default: this.RequestedOrientation = ScreenOrientation.Portrait; break; } }
public App() { InitializeComponent(); MainPage = new BarcodeReaderSample.MainPage(); }