예제 #1
0
        internal static bool Navigate(this global::Windows.UI.Xaml.Controls.Frame frame, ContentPage page, global::Windows.UI.Xaml.Media.Animation.NavigationTransitionInfo infoOverride)
        {
            if (page == null)
            {
                throw new ArgumentNullException(nameof(page));
            }

            Guid id = Guid.NewGuid();

            FormsEmbeddedPageWrapper.Pages.Add(id, page);
            if (infoOverride != null)
            {
                return(frame.Navigate(typeof(FormsEmbeddedPageWrapper), id, infoOverride));
            }

            return(frame.Navigate(typeof(FormsEmbeddedPageWrapper), id));
        }
예제 #2
0
        public async Task OpenSecondaryWindow(Type pageType)
        {
            CoreApplicationView newView = CoreApplication.CreateNewView();
            int newViewId = 0;
            await newView.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
            {
                var frame = new global::Windows.UI.Xaml.Controls.Frame();

                //The page instance must be created inside the new UI Thread.
                ContentPage instance = (ContentPage)Activator.CreateInstance(pageType);
                frame.Navigate(instance);
                Window.Current.Content = frame;
                Window.Current.Activate();

                newViewId = ApplicationView.GetForCurrentView().Id;
            });

            bool viewShown = await ApplicationViewSwitcher.TryShowAsStandaloneAsync(newViewId);
        }