Пример #1
0
        static void Main(string[] args)
        {
            var application = new Application();

            Forms.Init();
            var formsApplicationPage = new FormsApplicationPage();

            formsApplicationPage.LoadApplication(new XamarinNeller.App());

            Task.Run(() =>
            {
                Task.Delay(1000).Wait();

                application.Dispatcher.InvokeAsync(() =>
                {
                    var window = new Window()
                    {
                        Height = 600,
                        Width  = 600
                    };

                    var viewPage = new ViewPage()
                    {
                        HeightRequest = 500,
                        WidthRequest  = 500
                    };

                    var pageRenderer = new PageRenderer();

                    var mainPage = new MainPage();
                    pageRenderer.SetElement(viewPage);

                    //var formsContentLoader = new FormsContentLoader();
                    //var content = formsContentLoader.LoadContentAsync(window,null, mainPage,new CancellationToken()).Result;

                    var frameworkElement = pageRenderer.GetNativeElement();
                    window.Content       = frameworkElement;
                    window.Show();
                });
            });

            application.Run();
        }