コード例 #1
0
        async protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            Xamarin.Forms.Forms.Init(this, bundle);

            SplashPage splashPage = new SplashPage("@drawable/splash");

            FormsApp formsApp = new FormsApp();

            MXFormsContainer.Initialize(formsApp, formsApp.NavigationPage, (t) => {
                Xamarin.Forms.Device.BeginInvokeOnMainThread(() => {
                    //SetPage(formsApp.NavigationPage);
                });
            });

            MXFormsContainer.AddView <Home>(typeof(HomePage), ViewPerspective.Default);
            MXFormsContainer.AddView <About>(typeof(AboutPage), ViewPerspective.Default);


            await MXFormsContainer.Navigate("Home");


            SetPage(formsApp.NavigationPage);
        }
コード例 #2
0
        public HomePage()
        {
            BackgroundColor = Color.Blue;

            var button = new Button();

            button.Text     = "Press me";
            button.Clicked += (object sender, EventArgs e) => {
                MXFormsContainer.Navigate(this, "About");
            };

            this.Content = button;
        }
コード例 #3
0
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            Forms.Init();

            window = new UIWindow(UIScreen.MainScreen.Bounds);

            FormsApp formsApp = new FormsApp();

            var vc = formsApp.NavigationPage.CreateViewController();

            window.RootViewController = vc;
            window.MakeKeyAndVisible();

            string splashImage = "Default";

            if (UIScreen.MainScreen.Bounds.Height == 568)
            {
                splashImage = String.Format("{0}-568h", splashImage);
            }

            var splashPage = new SplashPage(splashImage);

            vc.PresentViewController(splashPage.CreateViewController(), false, null);

            MXFormsContainer.Initialize(formsApp, formsApp.NavigationPage, (t) => {
                this.InvokeOnMainThread(() => {
                    vc.DismissViewController(true, null);
                });
            });


            MXFormsContainer.AddView <Home>(typeof(HomePage), ViewPerspective.Default);
            MXFormsContainer.AddView <About>(typeof(AboutPage), ViewPerspective.Default);

            MXFormsContainer.Navigate("Home");
            return(true);
        }