void SetPage(Page page) { if (!Forms.IsInitialized) { throw new InvalidOperationException("Call Forms.Init (UIApplication) before this"); } if (_platform != null) { _platform.SetPage(page); return; } _platform = Platform.CreatePlatform(BaseLayout); _platform.HasAlpha = MainWindow.Alpha; BaseLayout.SetContent(_platform.GetRootNativeView()); _platform.RootNativeViewChanged += (s, e) => BaseLayout.SetContent(e.RootNativeView); if (_application != null) { _application.Platform = _platform; } _platform.SetPage(page); }
public PopupManager(ITizenPlatform platform) { _platform = platform; MessagingCenter.Subscribe <Page, bool>(this, Page.BusySetSignalName, OnBusySetRequest); MessagingCenter.Subscribe <Page, AlertArguments>(this, Page.AlertSignalName, OnAlertRequest); MessagingCenter.Subscribe <Page, ActionSheetArguments>(this, Page.ActionSheetSignalName, OnActionSheetRequest); MessagingCenter.Subscribe <Page, PromptArguments>(this, Page.PromptSignalName, OnPromptRequested); }
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); }
internal static ITizenPlatform CreatePlatform(EvasObject parent) { ITizenPlatform platform = PreloadedPlatform.GetInstalce(parent); if (Forms.Flags.Contains(Flags.LightweightPlatformExperimental)) { platform?.Dispose(); platform = new LightweightPlatform(parent); } else { platform = platform ?? new DefaultPlatform(parent); } return(platform); }
/// <summary> /// Exits the application's main loop, which initiates the process of its termination /// </summary> public override void Exit() { if (_platform == null) { Log.Warn("Exit was already called or FormsApplication is not initialized yet."); return; } try { _platform.Dispose(); _platform = null; } catch (Exception e) { Log.Error("Exception thrown from Dispose: {0}", e.Message); } base.Exit(); }