summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.ControlGallery.iOS/AppDelegate.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Xamarin.Forms.ControlGallery.iOS/AppDelegate.cs')
-rw-r--r--Xamarin.Forms.ControlGallery.iOS/AppDelegate.cs64
1 files changed, 44 insertions, 20 deletions
diff --git a/Xamarin.Forms.ControlGallery.iOS/AppDelegate.cs b/Xamarin.Forms.ControlGallery.iOS/AppDelegate.cs
index 7614796a..3eb36bfc 100644
--- a/Xamarin.Forms.ControlGallery.iOS/AppDelegate.cs
+++ b/Xamarin.Forms.ControlGallery.iOS/AppDelegate.cs
@@ -151,27 +151,12 @@ namespace Xamarin.Forms.ControlGallery.iOS
var app = new App();
- var mdp = app.MainPage as MasterDetailPage;
- var detail = mdp?.Detail as NavigationPage;
- if (detail != null)
- {
- detail.Pushed += (sender, args) =>
- {
- var nncgPage = args.Page as NestedNativeControlGalleryPage;
-
- if (nncgPage != null)
- {
- AddNativeControls(nncgPage);
- }
+ // When the native control gallery loads up, it'll let us know so we can add the nested native controls
+ MessagingCenter.Subscribe<NestedNativeControlGalleryPage>(this, NestedNativeControlGalleryPage.ReadyForNativeControlsMessage, AddNativeControls);
+ MessagingCenter.Subscribe<Bugzilla40911>(this, Bugzilla40911.ReadyToSetUp40911Test, SetUp40911Test);
- var nncgPage1 = args.Page as NativeBindingGalleryPage;
-
- if (nncgPage1 != null)
- {
- AddNativeBindings(nncgPage1);
- }
- };
- }
+ // When the native binding gallery loads up, it'll let us know so we can set up the native bindings
+ MessagingCenter.Subscribe<NativeBindingGalleryPage >(this, NativeBindingGalleryPage.ReadyForNativeBindingsMessage, AddNativeBindings);
LoadApplication(app);
return base.FinishedLaunching(uiApplication, launchOptions);
@@ -321,6 +306,45 @@ namespace Xamarin.Forms.ControlGallery.iOS
sl?.Children.Add(colorPicker);
page.NativeControlsAdded = true;
}
+
+ #region Stuff for repro of Bugzilla case 40911
+
+ void SetUp40911Test(Bugzilla40911 page)
+ {
+ var button = new Button { Text = "Start" };
+
+ button.Clicked += (s, e) =>
+ {
+ StartPressed40911();
+ };
+
+ page.Layout.Children.Add(button);
+ }
+
+ public void StartPressed40911 ()
+ {
+ var loginViewController = new UIViewController { View = { BackgroundColor = UIColor.White } };
+ var button = UIButton.FromType (UIButtonType.RoundedRect);
+ button.SetTitle ("Login", UIControlState.Normal);
+ button.Frame = new CGRect (20, 100, 200, 44);
+ loginViewController.View.AddSubview (button);
+
+ button.TouchUpInside += (sender, e) => {
+ Xamarin.Forms.Application.Current.MainPage = new ContentPage {Content = new Label {Text = "40911 Success"} };
+ loginViewController.DismissViewController (true, null);
+ };
+
+ var window= UIApplication.SharedApplication.KeyWindow;
+ var vc = window.RootViewController;
+ while (vc.PresentedViewController != null)
+ {
+ vc = vc.PresentedViewController;
+ }
+
+ vc.PresentViewController (loginViewController, true, null);
+ }
+
+ #endregion
}
public class ColorConverter : IValueConverter