void InitializeWindow() { Debug.Assert(MainWindow != null, "Window cannot be null"); MainWindow.Active(); MainWindow.Show(); // in case of no use of preloaded window if (BaseLayout == null) { var conformant = new Conformant(MainWindow); conformant.Show(); var layout = new ELayout(conformant); layout.SetTheme("layout", "application", "default"); layout.Show(); BaseLayout = layout; if (Device.Idiom == TargetIdiom.Watch) { BaseCircleSurface = new CircleSurface(conformant); Forms.CircleSurface = BaseCircleSurface; } conformant.SetContent(BaseLayout); } MainWindow.AvailableRotations = DisplayRotation.Degree_0 | DisplayRotation.Degree_90 | DisplayRotation.Degree_180 | DisplayRotation.Degree_270; MainWindow.Deleted += (s, e) => { Exit(); }; Device.Info.CurrentOrientation = MainWindow.GetDeviceOrientation(); MainWindow.RotationChanged += (sender, e) => { Device.Info.CurrentOrientation = MainWindow.GetDeviceOrientation(); }; MainWindow.BackButtonPressed += (sender, e) => { if (_platform != null) { if (!_platform.SendBackButtonPressed()) { Exit(); } } }; _platform = Platform.CreatePlatform(BaseLayout); BaseLayout.SetContent(_platform.GetRootNativeView()); _platform.RootNativeViewChanged += (s, e) => BaseLayout.SetContent(e.RootNativeView); }
void InitializeWindow() { Debug.Assert(MainWindow != null, "Window cannot be null"); MainWindow.Active(); MainWindow.Show(); if (MainWindow is PreloadedWindow precreated) { BaseLayout = precreated.BaseLayout; } else { var conformant = new Conformant(MainWindow); conformant.Show(); var layout = new ELayout(conformant); layout.SetTheme("layout", "application", "default"); layout.Show(); BaseLayout = layout; conformant.SetContent(BaseLayout); } MainWindow.AvailableRotations = DisplayRotation.Degree_0 | DisplayRotation.Degree_90 | DisplayRotation.Degree_180 | DisplayRotation.Degree_270; MainWindow.Deleted += (s, e) => { Exit(); }; Device.Info.CurrentOrientation = MainWindow.GetDeviceOrientation(); MainWindow.RotationChanged += (sender, e) => { Device.Info.CurrentOrientation = MainWindow.GetDeviceOrientation(); }; MainWindow.BackButtonPressed += (sender, e) => { if (_platform != null) { if (!_platform.SendBackButtonPressed()) { Exit(); } } }; _platform = Platform.CreatePlatform(BaseLayout); BaseLayout.SetContent(_platform.GetRootNativeView()); _platform.RootNativeViewChanged += (s, e) => BaseLayout.SetContent(e.RootNativeView); }