当前位置: 首页>>代码示例>>C#>>正文


C# Frame.Navigate方法代码示例

本文整理汇总了C#中Windows.UI.Xaml.Controls.Frame.Navigate方法的典型用法代码示例。如果您正苦于以下问题:C# Frame.Navigate方法的具体用法?C# Frame.Navigate怎么用?C# Frame.Navigate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Windows.UI.Xaml.Controls.Frame的用法示例。


在下文中一共展示了Frame.Navigate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnLaunched

        /// <summary>
        /// Setup the application and initialize the tests.
        /// </summary>
        /// <param name="args">
        /// Details about the launch request and process.
        /// </param>
        protected override void OnLaunched(LaunchActivatedEventArgs args)
        {
            // Do not repeat app initialization when already running, just
            // ensure that the window is active
            if (args.PreviousExecutionState == ApplicationExecutionState.Running)
            {
                Window.Current.Activate();
                return;
            }

            // Set the App Mode and configuration based on the arguments
            Harness.SetAutoConfig(args.Arguments);
            Frame rootFrame = new Frame();

            if (Harness.Settings.ManualMode)
            {
                rootFrame.Navigate(typeof(MainPage));
            }
            else
            {
                rootFrame.Navigate(typeof(TestPage));
            }

            Window.Current.Content = rootFrame;
            Window.Current.Activate();
        }
开发者ID:brettsam,项目名称:azure-mobile-apps-net-client,代码行数:32,代码来源:App.xaml.cs

示例2: OnLaunched

        /// <summary>
        /// Invoked when the application is launched normally by the end user.  Other entry points
        /// will be used when the application is launched to open a specific file, to display
        /// search results, and so forth.
        /// </summary>
        /// <param name="args">Details about the launch request and process.</param>
        protected override void OnLaunched(LaunchActivatedEventArgs args)
        {
            // Do not repeat app initialization when already running, just ensure that
            // the window is active
            if (args.PreviousExecutionState == ApplicationExecutionState.Running)
            {
                Window.Current.Activate();
                return;
            }

            if (args.PreviousExecutionState == ApplicationExecutionState.Terminated)
            {
                //TODO: Load state from previously suspended application
            }

            // Create a Frame to act navigation context and navigate to the first page
            var rootFrame = new Frame();
            SimpleIoc.Default.Register<INavigationService>(() => new NavigationService(rootFrame));

            if (!ApplicationData.Current.LocalSettings.Values.ContainsKey("SimBalanceBackgroundTask"))
            {
                //Register background worker
                var backgroundTaskManager = new BackgroundTaskBuilder
                                                {
                                                    TaskEntryPoint =
                                                        "MobileVikings.FrontEnd.BackgroundTasks.SimBalanceBackgroundTask",
                                                    Name = "SimBalanceBackgroundTask"
                                                };

                backgroundTaskManager.SetTrigger(new MaintenanceTrigger(15, false));
                backgroundTaskManager.AddCondition(new SystemCondition(SystemConditionType.InternetAvailable));
                var registration = backgroundTaskManager.Register();
                ApplicationData.Current.LocalSettings.Values["SimBalanceBackgroundTask"] = true;
            }

            if (ApplicationData.Current.RoamingSettings.Values["AuthorizationInfo"] == null)
            {
                if (!rootFrame.Navigate(typeof(LoginView)))
                {
                    throw new Exception("Failed to create initial page");
                }
            }
            else
            {
                if (!rootFrame.Navigate(typeof(MainView)))
                {
                    throw new Exception("Failed to create initial page");
                }
            }
            

            // Place the frame in the current Window and ensure that it is active
            Window.Current.Content = rootFrame;
            Window.Current.Activate();
        }
开发者ID:prebenh,项目名称:MobileVikings,代码行数:61,代码来源:App.xaml.cs

示例3: OnLaunched

        /// <summary>
        /// Invoked when the application is launched normally by the end user.  Other entry points
        /// will be used such as when the application is launched to open a specific file.
        /// </summary>
        /// <param name="args">Details about the launch request and process.</param>
        protected override void OnLaunched(LaunchActivatedEventArgs args)
        {

#if DEBUG
            if (System.Diagnostics.Debugger.IsAttached)
            {
                this.DebugSettings.EnableFrameRateCounter = true;
            }
#endif

            Frame rootFrame = Window.Current.Content as Frame;

            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active
            if (rootFrame == null)
            {
                // Create a Frame to act as the navigation context and navigate to the first page
                rootFrame = new Frame();

                rootFrame.NavigationFailed += OnNavigationFailed;

                if (args.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    //TODO: Load state from previously suspended application
                }

                Harness.SetAutoConfig(args.Arguments);

                if (Harness.Settings.ManualMode)
                {
                    rootFrame.Navigate(typeof(MainPage));
                }
                else
                {
                    rootFrame.Navigate(typeof(TestPage));
                }
                // Place the frame in the current Window
                Window.Current.Content = rootFrame;
            }

            if (rootFrame.Content == null)
            {
                // When the navigation stack isn't restored navigate to the first page,
                // configuring the new page by passing required information as a navigation
                // parameter
                rootFrame.Navigate(typeof(MainPage), args.Arguments);
            }
            // Ensure the current window is active
            Window.Current.Activate();
        }
开发者ID:Azure,项目名称:azure-mobile-apps-net-client,代码行数:55,代码来源:App.xaml.cs

示例4: OnLaunched

        /// <summary>
        /// Invoked when the application is launched normally by the end user.  Other entry points
        /// will be used when the application is launched to open a specific file, to display
        /// search results, and so forth.
        /// </summary>
        /// <param name="args">Details about the launch request and process.</param>
        protected override void OnLaunched(LaunchActivatedEventArgs args)
        {
            // TODO: Create a data model appropriate for your problem domain to replace the sample data
            var sampleData = new SampleDataSource();

            if (args.PreviousExecutionState == ApplicationExecutionState.Terminated)
            {
                //TODO: Load state from previously suspended application
            }

            // Create a Frame to act navigation context and navigate to the first page,
            // configuring the new page by passing required information as a navigation
            // parameter
            var rootFrame = new Frame();
            rootFrame.Navigate(typeof(Dashboard), sampleData);

            // Place the frame in the current Window and ensure that it is active
            Window.Current.Content = rootFrame;
            Window.Current.Activate();

            // move to an appropriate place
            var liveTiles = new LiveTiles();
            liveTiles.ShowAsLiveTile("Wash the car");
            liveTiles.ShowAsLiveTile("Do the dishes");
            liveTiles.ShowAsLiveTile("Show the app");
            liveTiles.ShowAsLiveTile("Mow the lawn");
            liveTiles.ShowAsBadge(6);
            liveTiles.ShowAsToast("Woot, a toast!");
        }
开发者ID:Goeleven,项目名称:Goeleven.Windows8,代码行数:35,代码来源:App.xaml.cs

示例5: OnLaunched

        /// <summary>
        /// Invoked when the application is launched normally by the end user.  Other entry points
        /// will be used when the application is launched to open a specific file, to display
        /// search results, and so forth.
        /// </summary>
        /// <param name="args">Details about the launch request and process.</param>
        protected override void OnLaunched(LaunchActivatedEventArgs args)
        {
            // Do not repeat app initialization when already running, just ensure that
            // the window is active
            if (args.PreviousExecutionState == ApplicationExecutionState.Running)
            {
                Window.Current.Activate();
                return;
            }

            if (args.PreviousExecutionState == ApplicationExecutionState.Terminated)
            {
                //TODO: Load state from previously suspended application
            }

            // Create a Frame to act navigation context and navigate to the first page
            var rootFrame = new Frame();
            if (!rootFrame.Navigate(typeof(MainPage)))
            {
                throw new Exception("Failed to create initial page");
            }
            /// <summary>
            /// Invoked when application execution is being suspended.  Application state is saved
            /// without knowing whether the application will be terminated or resumed with the contents
            /// of memory still intact.
            /// </summary>
            /// <param name="sender">The source of the suspend request.</

            // Place the frame in the current Window and ensure that it is active
            Window.Current.Content = rootFrame;
            Window.Current.Activate();
        }
开发者ID:dotnetcurry,项目名称:zumo-and-tick-tac-toe-leaderboard,代码行数:38,代码来源:App.xaml.cs

示例6: OnLaunched

 protected override void OnLaunched(LaunchActivatedEventArgs args)
 {
     var rootFrame = new Frame();
     rootFrame.Navigate(typeof(DefaultPage));
     Window.Current.Content = rootFrame;
     Window.Current.Activate();
 }
开发者ID:oldnewthing,项目名称:old-Windows8-samples,代码行数:7,代码来源:App.xaml.cs

示例7: OnLaunched

        /// <summary>
        /// Invoked when the application is launched normally by the end user.  Other entry points
        /// will be used when the application is launched to open a specific file, to display
        /// search results, and so forth.
        /// </summary>
        /// <param name="args">Details about the launch request and process.</param>
        protected override void OnLaunched(LaunchActivatedEventArgs args)
        {
            // Do not repeat app initialization when already running, just ensure that
            // the window is active
            if (args.PreviousExecutionState == ApplicationExecutionState.Running)
            {
                Window.Current.Activate();
                return;
            }

            if (args.PreviousExecutionState == ApplicationExecutionState.Terminated)
            {
                //TODO: Load state from previously suspended application
            }

            // Create a Frame to act navigation context and navigate to the first page
            var rootFrame = new Frame();
            if (!rootFrame.Navigate(typeof(MainPage)))
            {
                throw new Exception("Failed to create initial page");
            }

            // Place the frame in the current Window and ensure that it is active
            Window.Current.Content = rootFrame;
            Window.Current.Activate();

            TileUpdateManager.CreateTileUpdaterForApplication().StartPeriodicUpdate(
                new System.Uri(MobileService.ApplicationUri, "/api/notifications"),
                PeriodicUpdateRecurrence.HalfHour
            );
        }
开发者ID:kirpasingh,项目名称:MicrosoftAzureTrainingKit,代码行数:37,代码来源:App.xaml.cs

示例8: OnLaunched

        protected override async void OnLaunched(LaunchActivatedEventArgs args)
        {
            if (args.PreviousExecutionState == ApplicationExecutionState.Running)
            {
                Window.Current.Activate();
                return;
            }

            var rootFrame = new Frame();
            SuspensionManager.RegisterFrame(rootFrame, "AppFrame");

            if (args.PreviousExecutionState == ApplicationExecutionState.Terminated)
            {
                await SuspensionManager.RestoreAsync();
            }

            if (rootFrame.Content == null)
            {
                if (!rootFrame.Navigate(typeof(GroupedItemsPage), "AllGroups"))
                {
                    throw new Exception("Failed to create initial page");
                }
            }

            Window.Current.Content = rootFrame;
            Window.Current.Activate();
        }
开发者ID:shiftkey,项目名称:bearded-dangerzone,代码行数:27,代码来源:App.xaml.cs

示例9: ProjectAsync

        public async Task<int> ProjectAsync(Type viewType, DeviceInformation device = null)
        {
            int mainViewId = ApplicationView.GetForCurrentView().Id;
            int? secondViewId = null;

            var view = CoreApplication.CreateNewView();
            await view.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
            {
                secondViewId = ApplicationView.GetForCurrentView().Id;
                var rootFrame = new Frame();
                rootFrame.Navigate(viewType, null);
                Window.Current.Content = rootFrame;
                Window.Current.Activate();
            });

            if (secondViewId.HasValue)
            {
                if(device == null)
                    await ProjectionManager.StartProjectingAsync(secondViewId.Value, mainViewId);
                else
                    await ProjectionManager.StartProjectingAsync(secondViewId.Value, mainViewId, device);
            }

            return mainViewId;
        }
开发者ID:dimkname,项目名称:UAP-Samples,代码行数:25,代码来源:ProjectionService.cs

示例10: search

 private void search(object sender, RoutedEventArgs e)
 {
     Windows.Storage.ApplicationDataContainer localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
     main_page.App.key = s.Text;
     if (localSettings.Containers.ContainsKey(s.Text))
     {
         var rootFrame = new Frame();
         if (!rootFrame.Navigate(typeof(BlankPage3)))
         {
             throw new Exception("Failed to create initial page");
         } // Place the frame in the current Window and ensure that it is active
         Window.Current.Content = rootFrame;
         Window.Current.Activate();
     }
     else
     {
         var rootFrame = new Frame();
         if (!rootFrame.Navigate(typeof(BlankPage1)))
         {
             throw new Exception("Failed to create initial page");
         } // Place the frame in the current Window and ensure that it is active
         Window.Current.Content = rootFrame;
         Window.Current.Activate();
     }
 }
开发者ID:song-forever,项目名称:wordblocks,代码行数:25,代码来源:MainPage.xaml.cs

示例11: OnActivated

        protected override void OnActivated(IActivatedEventArgs args)
        {
            base.OnActivated(args);

            if (args.Kind == ActivationKind.VoiceCommand)
            {
                var commandArgs = args as VoiceCommandActivatedEventArgs;
                SpeechRecognitionResult speechRecognitionResult = commandArgs.Result;

                var text = speechRecognitionResult.Text;
                var status = speechRecognitionResult.Status;
                var commandName = speechRecognitionResult.RulePath[0];
                if(commandName == "command1")
                {

                }else if(commandName == "command2")
                {
                    Frame rootFrame = new Frame();
                    Window.Current.Content = rootFrame;

                    rootFrame.Navigate(typeof(SendPage),1);
                    Window.Current.Activate();
                }
                else if(commandName == "command3")
                {
                    Frame rootFrame = new Frame();
                    Window.Current.Content = rootFrame;

                    rootFrame.Navigate(typeof(SendPage),0);
                    Window.Current.Activate();
                }

            }
        }
开发者ID:garicchi,项目名称:CortanaSlide,代码行数:34,代码来源:App.xaml.cs

示例12: OnLaunched

        protected override async void OnLaunched(LaunchActivatedEventArgs args)
        {
            // Do not repeat app initialization when already running, just ensure that the window is active
            if (args.PreviousExecutionState == ApplicationExecutionState.Running)
            {
                Window.Current.Activate();
                return;
            }

            // Create a Frame to act as the navigation context and associate it with a SuspensionManager key
            var rootFrame = new Frame();
            SuspensionManager.RegisterFrame(rootFrame, "AppFrame");

            if (args.PreviousExecutionState == ApplicationExecutionState.Terminated)
            {
                await SuspensionManager.RestoreAsync();
            }

            if (rootFrame.Content == null)
            {
                if (!rootFrame.Navigate(typeof(HomeView), "AllGroups"))
                {
                    throw new Exception("Failed to create initial page");
                }
            }

            Window.Current.Content = rootFrame;
            Window.Current.Activate();
        }
开发者ID:shiftkey,项目名称:better-win8-templates,代码行数:29,代码来源:App.xaml.cs

示例13: InitialiseRootFrame

 private void InitialiseRootFrame(Frame rootFrame)
 {
     var networkProfile = Windows.Networking.Connectivity.NetworkInformation.GetInternetConnectionProfile();
     if (networkProfile != null && networkProfile.GetNetworkConnectivityLevel() == Windows.Networking.Connectivity.NetworkConnectivityLevel.InternetAccess)
     {
         Window.Current.Content = new Pages.Shell(rootFrame);
         rootFrame.NavigationFailed += OnNavigationFailed;
         if (rootFrame.Content == null)
         {
             // When the navigation stack isn't restored navigate to the first page,
             // configuring the new page by passing required information as a navigation
             // parameter
             rootFrame.Navigate(typeof(Pages.HomePage));
         }
     }
     else
     {
         rootFrame.Content = new TextBlock()
         {
             Text = "No internet connectivity",
             FontSize = 22,
             HorizontalAlignment = HorizontalAlignment.Center,
             VerticalAlignment = VerticalAlignment.Center
         };
         Window.Current.Content = rootFrame;
     }
 }
开发者ID:Pradyumna91,项目名称:8tracksWin,代码行数:27,代码来源:App.xaml.cs

示例14: BackMain_OnClick

		private void BackMain_OnClick(object sender, RoutedEventArgs e)
		{
			var fr = new Frame();
			fr.Navigate(typeof(MainPage));
			Window.Current.Content = fr;
			Window.Current.Activate();
		}
开发者ID:kfwls,项目名称:MissionControl-WinRT-Client,代码行数:7,代码来源:SubmitCompany.xaml.cs

示例15: CreateView_Click

        private async void CreateView_Click(object sender, RoutedEventArgs e)
        {
            // Set up the secondary view, but don't show it yet
            ViewLifetimeControl viewControl = null;
            await CoreApplication.CreateNewView().Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
            {
                // This object is used to keep track of the views and important
                // details about the contents of those views across threads
                // In your app, you would probably want to track information
                // like the open document or page inside that window
                viewControl = ViewLifetimeControl.CreateForCurrentView();
                viewControl.Title = DEFAULT_TITLE;
                // Increment the ref count because we just created the view and we have a reference to it                
                viewControl.StartViewInUse();

                var frame = new Frame();
                frame.Navigate(typeof(SecondaryViewPage), viewControl);
                Window.Current.Content = frame;
                // This is a change from 8.1: In order for the view to be displayed later it needs to be activated.
                Window.Current.Activate();
                ApplicationView.GetForCurrentView().Title = viewControl.Title;
            });

            // Be careful! This collection is bound to the current thread,
            // so make sure to update it only from this thread
            ((App)App.Current).SecondaryViews.Add(viewControl);
        }
开发者ID:COMIsLove,项目名称:Windows-universal-samples,代码行数:27,代码来源:Scenario1.xaml.cs


注:本文中的Windows.UI.Xaml.Controls.Frame.Navigate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。