Exemplo n.º 1
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            Xamarin.Forms.Forms.Init();
            BlazorHybridWindows.Init();

            // create a Xamarin Forms ContentPage container
            var xfContentPage = new Xamarin.Forms.ContentPage();

            // add MBB Hybrid Blazor/Xamarin components as-needed to that container
            _host.AddComponent <Main>(parent: xfContentPage);

            // optional, create a vanilla WPF container of some sort (here, a Grid)
            var grid = new System.Windows.Controls.Grid();

            // create a top-level vanilla WPF window, with the Grid as it's content
            var window = new Window {
                Content = grid
            };

            // add the Xamarin container to the WPF grid (can safely add other WPF elements to the grid as well)
            grid.Children.Add(xfContentPage.ToFrameworkElement());

            // show the top-level vanilla WPF window
            window.Show();
        }
Exemplo n.º 2
0
        public MainPage()
        {
            InitializeComponent();

            HelloFlyout.Content = new Hello().CreateFrameworkElement();

            _page4 = new Page4();
        }
Exemplo n.º 3
0
        /// <summary>
        /// Create an android host instance associated wth the specified activity and stateful container function.
        /// </summary>
        /// <param name="contentPage"></param>
        /// <param name="containerFactory"></param>
        /// <returns></returns>
        public static XamFormsBuildHostInstance Create(Xamarin.Forms.ContentPage contentPage, RootContainerFactory containerFactory)
        {
            if (_instance == null)
            {
                throw new InvalidOperationException("Host has not been initialized\n Add BuildHost.CreateHost(<<environment>>,optional <<hostFactory>>) to your application initialization code.");
            }

            return(_instance.CreateInstance(contentPage, containerFactory));
        }
Exemplo n.º 4
0
        protected override void BindPage(Xamarin.Forms.ContentPage page)
        {
            page.Appearing += delegate
            {
                RequestedRotation = DeviceRotation.Portrait;
            };

            page.Disappearing += delegate
            {
                RequestedRotation = DeviceRotation.Unknown;
            };
        }
Exemplo n.º 5
0
 public AppUpdateUtils(Xamarin.Forms.ContentPage page)
 {
     mPage = page;
 }
Exemplo n.º 6
0
        /// <summary>
        /// Create a host instance.
        /// </summary>
        /// <param name="contentPage"></param>
        /// <param name="containerFactory"></param>
        /// <returns></returns>
        private XamFormsBuildHostInstance CreateInstance(Xamarin.Forms.ContentPage contentPage, RootContainerFactory containerFactory)
        {
            var instanceHost = _hostFactory(contentPage, _hostEnvironment, containerFactory);

            return(instanceHost);
        }