void InternalSetPage(Page page) { if (!Forms.IsInitialized) { throw new InvalidOperationException("Call Forms.Init (Activity, Bundle) before this"); } if (Platform != null) { Platform.SetPage(page); return; } PopupManager.ResetBusyCount(this); Platform = new Platform(this); if (_application != null) { #pragma warning disable CS0618 // Type or member is obsolete // The Platform property is no longer necessary, but we have to set it because some third-party // library might still be retrieving it and using it _application.Platform = Platform; #pragma warning restore CS0618 // Type or member is obsolete } Platform.SetPage(page); _layout.AddView(Platform.GetViewGroup()); }
void InternalSetPage(Page page) { if (!Forms.IsInitialized) { throw new InvalidOperationException("Call Forms.Init (Activity, Bundle) before this"); } if (Platform != null) { Platform.SetPage(page); return; } PopupManager.ResetBusyCount(this); Platform = new Platform(this); Platform.SetPage(page); _layout.AddView(Platform.GetViewGroup()); }
#pragma warning restore 618 public static Fragment CreateSupportFragment(this ContentPage view, Context context) { if (!Forms.IsInitialized) { throw new InvalidOperationException("call Forms.Init() before this"); } if (!(view.RealParent is Application)) { Application app = new DefaultApplication(); app.MainPage = view; } var platform = new Platform(context, true); platform.SetPage(view); var vg = platform.GetViewGroup(); return(new EmbeddedSupportFragment(vg, platform)); }
void InternalSetPage(Page page) { if (!Forms.IsInitialized) { throw new InvalidOperationException("Call Forms.Init (Activity, Bundle) before this"); } if (_canvas != null) { _canvas.SetPage(page); return; } var busyCount = 0; MessagingCenter.Subscribe(this, Page.BusySetSignalName, (Page sender, bool enabled) => { busyCount = Math.Max(0, enabled ? busyCount + 1 : busyCount - 1); if (!Forms.SupportsProgress) { return; } SetProgressBarIndeterminate(true); UpdateProgressBarVisibility(busyCount > 0); }); UpdateProgressBarVisibility(busyCount > 0); MessagingCenter.Subscribe(this, Page.AlertSignalName, (Page sender, AlertArguments arguments) => { AlertDialog alert = new AlertDialog.Builder(this).Create(); alert.SetTitle(arguments.Title); alert.SetMessage(arguments.Message); if (arguments.Accept != null) { alert.SetButton((int)DialogButtonType.Positive, arguments.Accept, (o, args) => arguments.SetResult(true)); } alert.SetButton((int)DialogButtonType.Negative, arguments.Cancel, (o, args) => arguments.SetResult(false)); alert.CancelEvent += (o, args) => { arguments.SetResult(false); }; alert.Show(); }); MessagingCenter.Subscribe(this, Page.ActionSheetSignalName, (Page sender, ActionSheetArguments arguments) => { var builder = new AlertDialog.Builder(this); builder.SetTitle(arguments.Title); string[] items = arguments.Buttons.ToArray(); builder.SetItems(items, (sender2, args) => { arguments.Result.TrySetResult(items[args.Which]); }); if (arguments.Cancel != null) { builder.SetPositiveButton(arguments.Cancel, delegate { arguments.Result.TrySetResult(arguments.Cancel); }); } if (arguments.Destruction != null) { builder.SetNegativeButton(arguments.Destruction, delegate { arguments.Result.TrySetResult(arguments.Destruction); }); } AlertDialog dialog = builder.Create(); builder.Dispose(); //to match current functionality of renderer we set cancelable on outside //and return null dialog.SetCanceledOnTouchOutside(true); dialog.CancelEvent += (sender3, e) => { arguments.SetResult(null); }; dialog.Show(); }); _canvas = new Platform(this); if (_application != null) { _application.Platform = _canvas; } _canvas.SetPage(page); _layout.AddView(_canvas.GetViewGroup()); }