summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.ControlGallery.Android/Activity1.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Xamarin.Forms.ControlGallery.Android/Activity1.cs')
-rw-r--r--Xamarin.Forms.ControlGallery.Android/Activity1.cs39
1 files changed, 8 insertions, 31 deletions
diff --git a/Xamarin.Forms.ControlGallery.Android/Activity1.cs b/Xamarin.Forms.ControlGallery.Android/Activity1.cs
index 35f877dc..ad3945ee 100644
--- a/Xamarin.Forms.ControlGallery.Android/Activity1.cs
+++ b/Xamarin.Forms.ControlGallery.Android/Activity1.cs
@@ -205,17 +205,8 @@ namespace Xamarin.Forms.ControlGallery.Android
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);
LoadApplication (app);
}
@@ -327,29 +318,15 @@ namespace Xamarin.Forms.ControlGallery.Android
// uncomment to verify turning off title bar works. This is not intended to be dynamic really.
//Forms.SetTitleBarVisibility (AndroidTitleBarVisibility.Never);
- var app = new App ();
+ 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;
+ // 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);
- if (nncgPage != null) {
- AddNativeControls (nncgPage);
- }
+ // 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);
- var nncgPage1 = args.Page as NativeBindingGalleryPage;
-
- if (nncgPage1 != null)
- {
- AddNativeBindings(nncgPage1);
- }
-
- };
- }
-
- LoadApplication (app);
+ LoadApplication(app);
}
public override void OnConfigurationChanged (global::Android.Content.Res.Configuration newConfig)