Пример #1
0
		public override bool FinishedLaunching (UIApplication app, NSDictionary options)
		{
			// create a new window instance based on the screen size
			window = new UIWindow (UIScreen.MainScreen.Bounds);

			UINavigationBar.Appearance.TintColor = Color.Yellow.ToUIColor ();
			UINavigationBar.Appearance.BarTintColor = Color.Green.ToUIColor ();

			//override navigation bar title with text attributes
			UINavigationBar.Appearance.SetTitleTextAttributes(new UITextAttributes () {
				TextColor = Color.Pink.ToUIColor ()
			});

			Xamarin.Calabash.Start ();
			Forms.Init ();
			FormsMaps.Init ();
			window.RootViewController = FormsApp.GetFormsApp ().CreateViewController ();
		
			MessagingCenter.Subscribe<RootPagesGallery, Type> (this, Messages.ChangeRoot, (sender, pagetype) => {
				window = new UIWindow (UIScreen.MainScreen.Bounds);
				window.RootViewController = ((Page) Activator.CreateInstance(pagetype)).CreateViewController();
				window.MakeKeyAndVisible ();
			});

			MessagingCenter.Subscribe<HomeButton> (this, Messages.GoHome, (sender) => {
				window = new UIWindow (UIScreen.MainScreen.Bounds);
				window.RootViewController = FormsApp.GetFormsApp ().CreateViewController ();
				window.MakeKeyAndVisible ();
			});

			// make the window visible
			window.MakeKeyAndVisible ();

			return true;
		}
Пример #2
0
        public MainPage()
        {
            InitializeComponent();

            Forms.Init();
            FormsMaps.Init();

            Content = CoreGallery.GetMainPage().ConvertPageToUIElement(this);

            MessagingCenter.Subscribe <RootPagesGallery, Type>(this, Messages.ChangeRoot, (sender, pagetype) =>
            {
                var page     = ((Page)Activator.CreateInstance(pagetype));
                app.MainPage = page;
            });

            MessagingCenter.Subscribe <HomeButton>(this, Messages.GoHome, (sender) => {
                var page     = FormsApp.GetFormsApp();
                app.MainPage = page;
            });
        }
Пример #3
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            System.Maui.Maui.Init(this, bundle);
            FormsMaps.Init(this, bundle);

            SetPage(FormsApp.GetFormsApp());

            MessagingCenter.Subscribe <RootPagesGallery, Type> (this, Messages.ChangeRoot, (sender, pageType) => {
                var page = ((Page)Activator.CreateInstance(pageType));
                SetPage(page);
            });

            MessagingCenter.Subscribe <RootPagesGallery, Type> (this, Messages.ChangeRoot, (sender, pageType) => {
                var page = ((Page)Activator.CreateInstance(pageType));
                SetPage(page);
            });

            MessagingCenter.Subscribe <HomeButton> (this, Messages.GoHome, (sender) => {
                var screen = FormsApp.GetFormsApp();
                SetPage(screen);
            });
        }
Пример #4
0
 public static void Main(string[] args)
 {
     UI.Publish("/", new App().Element);
     UI.Publish("/forms", FormsApp.GetFormsApp());
 }
Пример #5
0
 public object GetForms() => new ElementResult(FormsApp.GetFormsApp());