Example #1
0
 private async void HyperlinkButton_Click_1(object sender, RoutedEventArgs e)
 {
     var currentViewId = ApplicationView.GetForCurrentView().Id;
     await CoreApplication.CreateNewView().Dispatcher.RunAsync(CoreDispatcherPriority.Normal, async() =>
     {
         var sub     = Window.Current;
         var frame   = new Frame();
         sub.Content = frame;
         frame.Navigate(typeof(SubWindowMainPage));
         sub.Activate();
         await ApplicationViewSwitcher.TryShowAsStandaloneAsync(
             ApplicationView.GetApplicationViewIdForWindow(sub.CoreWindow),
             ViewSizePreference.Default,
             currentViewId,
             ViewSizePreference.Default);
     });
 }
Example #2
0
        /// <summary>
        /// Experimental!
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="parameter"></param>
        /// <returns></returns>
        public static async Task <WindowService> CreateNewWindowAsync <T>(object parameter = null) where T : ViewModelBase
        {
            //https://github.com/Microsoft/Windows-universal-samples/blob/master/Samples/MultipleViews/cs/Scenario1.xaml.cs#L71

            var view = CoreApplication.CreateNewView();
            //and here, the above HandleNewWindow method should be called.

            var bundle = WindowNavigationServices.First(x => x.WindowView.Dispatcher == view.Dispatcher);

            await bundle.WindowView.Dispatcher.RunIdleAsync(new IdleDispatchedHandler(x =>
            {
                bundle.NavigationManager.RootNavigationService.NavigateTo <T>(parameter);
            }));


            return(bundle);
        }
Example #3
0
        public async Task OpenWindowAsync()
        {
            int currentViewId           = ApplicationView.GetForCurrentView().Id;
            CoreApplicationView newView = CoreApplication.CreateNewView();
            int newViewId = 0;
            await newView.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
            {
                var frame = new Frame();
                frame.Navigate(typeof(ToolsPage));
                Window.Current.Content = frame;
                Window.Current.Activate();

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

            bool viewShown = await ApplicationViewSwitcher.TryShowAsStandaloneAsync(newViewId, ViewSizePreference.UseLess, currentViewId, ViewSizePreference.UseMore);
        }
Example #4
0
        //Button click event for CompactOverlayButton to Create a Frame in CompactOverlay mode
        public async void CompactOverlayButton_ClickAsync(object sender, RoutedEventArgs e)
        {
            int compactViewId = ApplicationView.GetForCurrentView().Id;      //Initializing compactViewId to the Current View ID
            await CoreApplication.CreateNewView().Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
            {
                var frame     = new Frame();
                compactViewId = ApplicationView.GetForCurrentView().Id;
                frame.Navigate(typeof(MainPage));
                Window.Current.Content = frame;
                Window.Current.Activate();
                ApplicationView.GetForCurrentView().Title = "";
            });

            bool viewShown = await ApplicationViewSwitcher.TryShowAsViewModeAsync(compactViewId, ApplicationViewMode.CompactOverlay);

            compactOverlayButton.Visibility = Visibility.Collapsed;
        }
Example #5
0
        public async Task <ViewLifetimeControl> OpenAsync(ViewServiceParams parameters)
        {
            //if (ApiInformation.IsPropertyPresent("Windows.UI.ViewManagement.ApplicationView", "PersistedStateId"))
            //{
            //    try
            //    {
            //        ApplicationView.ClearPersistedState("Calls");
            //    }
            //    catch { }
            //}

            var newView    = CoreApplication.CreateNewView();
            var dispatcher = new DispatcherContext(newView.DispatcherQueue);

            var newControl = await dispatcher.DispatchAsync(async() =>
            {
                var newWindow  = Window.Current;
                var newAppView = ApplicationView.GetForCurrentView();

                newAppView.Title = parameters.Title ?? string.Empty;

                if (ApiInformation.IsPropertyPresent("Windows.UI.ViewManagement.ApplicationView", "PersistedStateId"))
                {
                    newAppView.PersistedStateId = parameters.PersistentId;
                }

                var control       = ViewLifetimeControl.GetForCurrentView();
                control.Released += (s, args) =>
                {
                    newWindow.Close();
                };

                newWindow.Content = parameters.Content(control);
                newWindow.Activate();

                var preferences        = ViewModePreferences.CreateDefault(parameters.ViewMode);
                preferences.CustomSize = new Size(parameters.Width, parameters.Height);

                await ApplicationViewSwitcher.TryShowAsViewModeAsync(newAppView.Id, parameters.ViewMode, preferences);
                //newAppView.TryResizeView(new Size(parameters.Width, parameters.Height));

                return(control);
            }).ConfigureAwait(false);

            return(newControl);
        }
Example #6
0
        private async void LoadCharacterCreationPage(object param)
        {
            var viewId  = 0;
            var newView = CoreApplication.CreateNewView();
            await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
            {
                var frame = new Frame();
                frame.Navigate(typeof(CharacterCreation), param);
                Window.Current.Content = frame;

                viewId = ApplicationView.GetForCurrentView().Id;

                Window.Current.Activate();
            });

            var viewShown = await ApplicationViewSwitcher.TryShowAsStandaloneAsync(viewId);
        }
Example #7
0
        private async void NavView_Navigate(NavigationViewItem item)
        {
            switch (item.Tag)
            {
            case "Home":
                ContentFrame.Navigate(typeof(Home));
                break;

            case "BarberSelection":
                ContentFrame.Navigate(typeof(BarberSelection));
                break;

            case "CreateBarbers":
                ContentFrame.Navigate(typeof(CreateBarbers));
                break;

            case "Clients":
                ContentFrame.Navigate(typeof(Clients));
                break;

            case "QueueDisplay":
                CoreApplicationView newCoreView = CoreApplication.CreateNewView();

                ApplicationView newAppView = null;
                int             mainViewId = ApplicationView.GetApplicationViewIdForWindow(
                    CoreApplication.MainView.CoreWindow);

                await newCoreView.Dispatcher.RunAsync(
                    CoreDispatcherPriority.Normal,
                    () =>
                {
                    newAppView             = ApplicationView.GetForCurrentView();
                    tvDisplay              = new QueueDisplay();
                    Window.Current.Content = tvDisplay;
                    Window.Current.Activate();
                });

                await ApplicationViewSwitcher.TryShowAsStandaloneAsync(
                    newAppView.Id,
                    ViewSizePreference.Custom,
                    mainViewId,
                    ViewSizePreference.Custom);

                break;
            }
        }
Example #8
0
        /// <summary>
        /// Creates a new application <see cref="Window"/> with the specified page type and navigation parameter.
        /// </summary>
        /// <param name="sourcePageType">
        /// The page type to load in the new Window.
        /// </param>
        /// <param name="parameter">
        /// The parameter to load in the new Window.
        /// </param>
        /// <param name="desiredSize">
        /// The desired size of the new Window.
        /// </param>
        /// <returns>
        /// Returns true if loaded; else false.
        /// </returns>
        public static async Task <bool> CreateNewWindowForPageAsync(
            Type sourcePageType,
            object parameter,
            Size desiredSize)
        {
            var newApplicationView = CoreApplication.CreateNewView();

            var coreWindow = CoreApplication.GetCurrentView().CoreWindow;
            var mainViewId = ApplicationView.GetApplicationViewIdForWindow(coreWindow);

            var newApplicationViewId = 0;

            await newApplicationView.Dispatcher.RunAsync(
                CoreDispatcherPriority.Normal,
                () =>
            {
                newApplicationViewId = ApplicationView.GetForCurrentView().Id;

                var frame = new Frame();
                Window.Current.Content = frame;

                RegisterViewServices(newApplicationViewId, newApplicationView.Dispatcher, frame);

                frame.Navigate(sourcePageType, parameter);
                Window.Current.Activate();
            });

            var shown = await ApplicationViewSwitcher.TryShowAsStandaloneAsync(
                newApplicationViewId,
                ViewSizePreference.UseMore,
                mainViewId,
                ViewSizePreference.Default);

            if (shown && desiredSize != Size.Empty)
            {
                await newApplicationView.Dispatcher.RunAsync(
                    CoreDispatcherPriority.Normal,
                    () =>
                {
                    var view = ApplicationView.GetForCurrentView();
                    view?.TryResizeView(desiredSize);
                });
            }

            return(shown);
        }
Example #9
0
        public async Task CreateNewView <T>(Func <T> newViewObjectFactory, Action <T> loadAction)
            where T : UIElement
        {
            CoreApplicationView newView = CoreApplication.CreateNewView();
            var newViewId = 0;
            await newView.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
            {
                var newViewContent     = newViewObjectFactory();
                Window.Current.Content = newViewContent;
                Window.Current.Activate();
                newViewId = ApplicationView.GetForCurrentView().Id;

                loadAction(newViewContent);
            });

            var viewShown = await ApplicationViewSwitcher.TryShowAsViewModeAsync(newViewId, ApplicationViewMode.CompactOverlay);
        }
Example #10
0
        /// <summary>
        /// This method creates a new view for our flat XAML page. It also saves off the view ID so we can navigate to the new view later.
        /// Additionally, this sets a delegate in the Unity script AppViewSwitcher, which will allow it to call a method in this file from the Unity view.
        /// </summary>
        public async void SetUpFlatView()
        {
            if (app.FlatViewId == 0)
            {
                CoreApplicationView FlatPageView = CoreApplication.CreateNewView();
                await FlatPageView.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
                {
                    app.FlatViewId = ApplicationView.GetForCurrentView().Id;
                    Frame frame    = new Frame();
                    frame.Navigate(typeof(FlatPage), null);
                    Window.Current.Content = frame;
                    Window.Current.Activate();
                });
            }

            AppViewSwitcher.NavigateToFlat = SwitchToFlat;
        }
Example #11
0
        private async Task CreateNewViewAsync()
        {
            CoreApplicationView newView = CoreApplication.CreateNewView();
            int newViewId = 0;
            await newView.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
            {
                Frame frame = new Frame();
                frame.Navigate(typeof(SecondaryPage), null);
                Window.Current.Content = frame;
                // You have to activate the window in order to show it later.
                Window.Current.Activate();

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

            bool viewShown = await ApplicationViewSwitcher.TryShowAsStandaloneAsync(newViewId);
        }
Example #12
0
        private async void NewViewButton_Click(object sender, RoutedEventArgs e)
        {
            CoreApplicationView newView = CoreApplication.CreateNewView();
            int newViewId = 0;
            await newView.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
            {
                Frame frame = new Frame();
                frame.Navigate(typeof(SecondaryView), null);
                Window.Current.Content = frame;

                Window.Current.Activate();

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

            bool viewShown = await ApplicationViewSwitcher.TryShowAsStandaloneAsync(newViewId, ViewSizePreference.UseHalf);
        }
        private async void GridView_ItemClick(object sender, ItemClickEventArgs e)
        {
            var myView    = CoreApplication.CreateNewView();
            int newViewId = 0;
            //int numero = (e.ClickedItem as Formato).formato_id;
            object f = e.ClickedItem;
            await myView.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
            {
                Frame newFrame = new Frame();
                newFrame.Navigate(typeof(Editor), f);
                Window.Current.Content = newFrame;
                Window.Current.Activate();
                newViewId = ApplicationView.GetForCurrentView().Id;
            });

            await ApplicationViewSwitcher.TryShowAsStandaloneAsync(newViewId, ViewSizePreference.UseHalf);
        }
        //DUPLICA FINESTRA
        private async void duplica_finestra_btn_Click(object sender, RoutedEventArgs e)
        {
            CoreApplicationView newView = CoreApplication.CreateNewView();
            int newViewId = 0;
            await newView.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
            {
                Frame frame = new Frame();
                frame.Navigate(typeof(AltriFrutti), null);
                Window.Current.Content = frame;
                // You have to activate the window in order to show it later.
                Window.Current.Activate();

                newViewId = Windows.UI.ViewManagement.ApplicationView.GetForCurrentView().Id;
            });

            bool viewShown = await ApplicationViewSwitcher.TryShowAsStandaloneAsync(newViewId);
        }
        private async void OldTrafford(object sender, RoutedEventArgs e)
        {
            //this.Frame.Navigate(typeof(Pages.Maps.OldTrafford));
            //// MyText.Text = "Hello World";
            CoreApplicationView newView = CoreApplication.CreateNewView();
            int newViewId = 0;
            await newView.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
            {
                Frame frame = new Frame();
                frame.Navigate(typeof(Pages.Maps.OldTrafford));
                Window.Current.Content = frame;
                Window.Current.Activate();
                newViewId = ApplicationView.GetForCurrentView().Id;
            });

            await ApplicationViewSwitcher.TryShowAsStandaloneAsync(newViewId);
        }
        private async void CreateView_Click(object sender, RoutedEventArgs e)
        {
            ViewLifeTimeControl viewControl = null;
            await CoreApplication.CreateNewView().Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
            {
                viewControl       = ViewLifeTimeControl.CreateForCurrentView();
                viewControl.Title = DEFAULT_TITLE;
                viewControl.StartViewInUse();
                Frame frame = new Frame();
                frame.Navigate(typeof(SecondaryViewPage), viewControl);
                Window.Current.Content = frame;
                Window.Current.Activate();
                ApplicationView.GetForCurrentView().Title = viewControl.Title;
            });

            ((App)App.Current).SecondaryViews.Add(viewControl);
        }
Example #17
0
        public static async Task <bool> CreateShowStandaloneWindow(string title, List <Setting> settings)
        {
            CoreApplicationView newView = CoreApplication.CreateNewView();
            int newViewId = 0;

            await newView.RunNormal(() =>
            {
                //The instance of the control must be created in the Thread of the new window
                var instance           = CreateSettings(title, settings, false);
                Window.Current.Content = instance;
                Window.Current.Activate();
                ApplicationView.GetForCurrentView().Title = title;
                newViewId = ApplicationView.GetForCurrentView().Id;
            });

            return(await ApplicationViewSwitcher.TryShowAsStandaloneAsync(newViewId, ViewSizePreference.UseMore));
        }
Example #18
0
        private async void OpenLobbyInterface()
        {
            var viewId  = 0;
            var newView = CoreApplication.CreateNewView();
            await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
            {
                var frame = new Frame();
                frame.Navigate(typeof(PlayerLobby));
                Window.Current.Content = frame;

                viewId = ApplicationView.GetForCurrentView().Id;

                Window.Current.Activate();
            });

            var viewShown = await ApplicationViewSwitcher.TryShowAsStandaloneAsync(viewId);
        }
Example #19
0
        private async void OpenNewWindowClick(object sender, RoutedEventArgs e)
        {
            var currentViewId = ApplicationView.GetForCurrentView().Id;
            var newViewId = default(int);
            await CoreApplication.CreateNewView().Dispatcher.RunAsync(
                CoreDispatcherPriority.Normal,
                () =>
            {
                var frame = new Frame();
                frame.Navigate(typeof(MainPage));
                Window.Current.Content = frame;

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

            await ApplicationViewSwitcher.TryShowAsStandaloneAsync(newViewId);
        }
Example #20
0
        private async void OpenNewPageAsync(Type pageName)
        {
            var viewId  = 0;
            var newView = CoreApplication.CreateNewView();
            await newView.Dispatcher.RunAsync(
                CoreDispatcherPriority.Normal,
                () =>
            {
                var frame = new Frame();
                frame.Navigate(pageName, null);
                Window.Current.Content = frame;
                viewId = ApplicationView.GetForCurrentView().Id;
                Window.Current.Activate();
            });

            var viewShown = await ApplicationViewSwitcher.TryShowAsStandaloneAsync(viewId);
        }
Example #21
0
        private async void OpenAdvancedProperties()
        {
            if (SecurityProperties == null)
            {
                return;
            }

            if (ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 8))
            {
                if (propsView == null)
                {
                    var newWindow = CoreApplication.CreateNewView();

                    await newWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, async() =>
                    {
                        Frame frame = new Frame();
                        frame.Navigate(typeof(PropertiesSecurityAdvanced), new PropertiesPageNavigationArguments()
                        {
                            Item = SecurityProperties.Item,
                            AppInstanceArgument = AppInstance
                        }, new SuppressNavigationTransitionInfo());
                        Window.Current.Content = frame;
                        Window.Current.Activate();

                        propsView = ApplicationView.GetForCurrentView();
                        newWindow.TitleBar.ExtendViewIntoTitleBar = true;
                        propsView.Title            = string.Format("SecurityAdvancedPermissionsTitle".GetLocalized(), SecurityProperties.Item.ItemName);
                        propsView.PersistedStateId = "PropertiesSecurity";
                        propsView.SetPreferredMinSize(new Size(400, 500));
                        propsView.Consolidated += PropsView_Consolidated;

                        bool viewShown = await ApplicationViewSwitcher.TryShowAsStandaloneAsync(propsView.Id);
                        if (viewShown && propsView != null)
                        {
                            // Set window size again here as sometimes it's not resized in the page Loaded event
                            propsView.TryResizeView(new Size(850, 550));
                        }
                    });
                }
                await ApplicationViewSwitcher.SwitchAsync(propsView.Id);
            }
            else
            {
                // Unsupported
            }
        }
Example #22
0
        private async void TabViewWindowingButton_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e)
        {
            CoreApplicationView newView = CoreApplication.CreateNewView();
            int newViewId = 0;
            await newView.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
            {
                Frame frame = new Frame();
                frame.Navigate(typeof(TabViewWindowingSamplePage), null);
                Window.Current.Content = frame;
                // You have to activate the window in order to show it later.
                Window.Current.Activate();

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

            bool viewShown = await ApplicationViewSwitcher.TryShowAsStandaloneAsync(newViewId);
        }
Example #23
0
        private async void DownloadsNavigationViewItem_Tapped(object sender, TappedRoutedEventArgs e)
        {
            ViewModel.SelectedApp = null;
            CoreApplicationView newView = CoreApplication.CreateNewView();
            int newViewId = 0;
            await newView.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
            {
                Frame frame = new Frame();
                frame.Navigate(typeof(DownloadPage));
                Window.Current.Content = frame;
                Window.Current.Activate();

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

            await ApplicationViewSwitcher.TryShowAsStandaloneAsync(newViewId);
        }
Example #24
0
        /// <summary>
        /// 打开窗口,如果窗口已存在则显示窗口
        /// </summary>
        /// <returns></returns>
        public async Task OpenNewWindowAsync()
        {
            //https://yq.aliyun.com/articles/676624
            //https://www.cnblogs.com/ms-uap/p/5535681.html
            GC.Collect();
            CoreApplicationView newView = CoreApplication.CreateNewView();

            if (viewShown)
            {
                if (viewClosed)
                {
                    if (!CacheView)
                    {
                        await frame.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { frame.Navigate(pageType); });
                    }
                    await ApplicationViewSwitcher.TryShowAsStandaloneAsync(newViewId);

                    viewClosed = false;
                }
                else
                {
                    await ApplicationViewSwitcher.SwitchAsync(newViewId);
                }
            }
            else
            {
                await newView.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
                {
                    var newWindow                             = Window.Current;
                    var newAppView                            = ApplicationView.GetForCurrentView();
                    newAppView.Consolidated                  += NewAppView_Consolidated;
                    newAppView.Title                          = title;
                    newAppView.TitleBar.BackgroundColor       = Windows.UI.ColorHelper.FromArgb(0xff, 0xee, 0xee, 0xee);
                    newAppView.TitleBar.ButtonBackgroundColor = Windows.UI.ColorHelper.FromArgb(0xff, 0xee, 0xee, 0xee);
                    frame           = new Frame();
                    frame.CacheSize = 0;
                    frame.Navigate(pageType);
                    newWindow.Content = frame;
                    newWindow.Activate();
                    newViewId = newAppView.Id;
                });

                viewShown = await ApplicationViewSwitcher.TryShowAsStandaloneAsync(newViewId);
            }
        }
Example #25
0
        protected override async void OnFileActivated(FileActivatedEventArgs args)
        {
            if (Window.Current.Content != null)
            {
                ApplicationView view     = null;
                var             coreView = CoreApplication.CreateNewView();
                await coreView.Dispatcher.AwaitableRunAsync(() => view = SetupCurrentView());

                await ApplicationViewSwitcher.TryShowAsStandaloneAsync(view.Id, ViewSizePreference.UseMinimum);

                await coreView.Dispatcher.AwaitableRunAsync(() => OnFileActivatedForWindow(args));
            }
            else
            {
                SetupCurrentView();
                OnFileActivatedForWindow(args);
            }
        }
Example #26
0
        private async void tappedEventHandler(object sender, TappedRoutedEventArgs e)
        {
            await userF.GlobalSignOutAsync();

            CoreApplicationView loginPage = CoreApplication.CreateNewView();
            int newViewId = 0;
            await loginPage.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
            {
                Frame frame = new Frame();
                frame.Navigate(typeof(MainPage));
                Window.Current.Content = frame;
                Window.Current.Activate();

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

            await ApplicationViewSwitcher.SwitchAsync(newViewId, currentID, ApplicationViewSwitchingOptions.ConsolidateViews);
        }
        //private async void LookupQualBtn_Click(object sender, RoutedEventArgs e)
        //{
        //    //this.Frame.Navigate(typeof(View.QualificationLookup));
        //    CoreApplicationView newView = CoreApplication.CreateNewView();
        //    int newViewId = 0;
        //    await newView.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
        //    {
        //        Frame frame = new Frame();
        //        frame.Navigate(typeof(View.QualificationLookup), null);
        //        Window.Current.Content = frame;
        //        // You have to activate the window in order to show it later.
        //        Window.Current.Activate();

        //        newViewId = ApplicationView.GetForCurrentView().Id;
        //    });
        //    bool viewShown = await ApplicationViewSwitcher.TryShowAsStandaloneAsync(newViewId);
        //}

        private async void LookupQualHyperlinkBtn_Click(object sender, RoutedEventArgs e)
        {
            //this.Frame.Navigate(typeof(View.QualificationLookup));
            CoreApplicationView newView = CoreApplication.CreateNewView();
            int newViewId = 0;
            await newView.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
            {
                Frame frame = new Frame();
                frame.Navigate(typeof(View.QualificationLookup), null);
                Window.Current.Content = frame;
                // You have to activate the window in order to show it later.
                Window.Current.Activate();

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

            bool viewShown = await ApplicationViewSwitcher.TryShowAsStandaloneAsync(newViewId);
        }
Example #28
0
        private async void EditInfo_Click(object sender, RoutedEventArgs e)
        {
            //Frame.Navigate(typeof(BlankPage1));
            var myview    = CoreApplication.CreateNewView();
            int newViewId = 0;
            await myview.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
            {
                Frame newFrame = new Frame();
                newFrame.Navigate(typeof(BlankPage1), null);
                Window.Current.Content = newFrame;
                Window.Current.Activate();
                newViewId = ApplicationView.GetForCurrentView().Id;
            });

            await ApplicationViewSwitcher.TryShowAsStandaloneAsync(newViewId, ViewSizePreference.UseMinimum);

            // await ApplicationViewSwitcher.TryShowAsViewModeAsync(newViewId, ApplicationViewMode.CompactOverlay);
        }
Example #29
0
        private async Task <ViewLifetimeControl> CreateViewLifetimeControlAsync(string windowTitle, Type pageType)
        {
            ViewLifetimeControl viewControl = null;

            await CoreApplication.CreateNewView().Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
            {
                viewControl       = ViewLifetimeControl.CreateForCurrentView();
                viewControl.Title = windowTitle;
                viewControl.StartViewInUse();
                var frame = new Frame();
                frame.Navigate(pageType, viewControl);
                Window.Current.Content = frame;
                Window.Current.Activate();
                ApplicationView.GetForCurrentView().Title = viewControl.Title;
            });

            return(viewControl);
        }
        /**
         * Apply for Parchment Request Button
         * A page (View.ParchmentRequest) pops up allowing user to apply for a parchment request
         **/
        private async void ApplyForParchmentBtn_Click(object sender, RoutedEventArgs e)
        {
            //this.Frame.Navigate(typeof(View.ParchmentRequest));
            CoreApplicationView newView = CoreApplication.CreateNewView();
            int newViewId = 0;
            await newView.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
            {
                Frame frame = new Frame();
                frame.Navigate(typeof(View.ParchmentRequest), new string[] { StudentID });
                Window.Current.Content = frame;
                // You have to activate the window in order to show it later.
                Window.Current.Activate();

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

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