當前位置: 首頁>>代碼示例>>C#>>正文


C# Region.RequestNavigate方法代碼示例

本文整理匯總了C#中Prism.Regions.Region.RequestNavigate方法的典型用法代碼示例。如果您正苦於以下問題:C# Region.RequestNavigate方法的具體用法?C# Region.RequestNavigate怎麽用?C# Region.RequestNavigate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Prism.Regions.Region的用法示例。


在下文中一共展示了Region.RequestNavigate方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: MissingCandidateViewCreatesViewInRegion

        public void MissingCandidateViewCreatesViewInRegion()
        {
            this.ConfigureMockServiceLocator();

            // We cannot access the UnityRegionNavigationContentLoader directly so we need to call its
            // GetCandidatesFromRegion method through a navigation request.
            IRegion testRegion = new Region();

            Assert.AreEqual(0, testRegion.Views.Count());
            Assert.AreEqual(0, testRegion.ActiveViews.Count());

            testRegion.RequestNavigate("MockView1");

            Assert.AreEqual(1, testRegion.Views.Count());
            Assert.AreEqual(1, testRegion.ActiveViews.Count());
        }
開發者ID:ValdimarThor,項目名稱:Prism,代碼行數:16,代碼來源:MefRegionNavigationContentLoaderFixture.cs

示例2: ShouldFindCandidateViewWithFriendlyNameInRegion

        public void ShouldFindCandidateViewWithFriendlyNameInRegion()
        {
            this.ConfigureMockServiceLocator();

            // We cannot access the MefRegionNavigationContentLoader directly so we need to call its
            // GetCandidatesFromRegion method through a navigation request.
            IRegion testRegion = new Region();

            MockView2 view = new MockView2();
            testRegion.Add(view);
            testRegion.Deactivate(view);

            testRegion.RequestNavigate("SomeView");

            Assert.IsTrue(testRegion.Views.Contains(view));
            Assert.IsTrue(testRegion.Views.Count() == 1);
            Assert.IsTrue(testRegion.ActiveViews.Count() == 1);
            Assert.IsTrue(testRegion.ActiveViews.Contains(view));
        }
開發者ID:ValdimarThor,項目名稱:Prism,代碼行數:19,代碼來源:MefRegionNavigationContentLoaderFixture.cs

示例3: ShouldFindCandidateViewInRegion

        public void ShouldFindCandidateViewInRegion()
        {
            IUnityContainer container = new UnityContainer();
            container.RegisterType<object, MockView>("MockView");

            this.ConfigureMockServiceLocator(container);

            // We cannot access the UnityRegionNavigationContentLoader directly so we need to call its
            // GetCandidatesFromRegion method through a navigation request.
            IRegion testRegion = new Region();

            MockView view = new MockView();
            testRegion.Add(view);
            testRegion.Deactivate(view);

            testRegion.RequestNavigate("MockView");

            Assert.IsTrue(testRegion.Views.Contains(view));
            Assert.IsTrue(testRegion.Views.Count() == 1);
            Assert.IsTrue(testRegion.ActiveViews.Count() == 1);
            Assert.IsTrue(testRegion.ActiveViews.Contains(view));
        }
開發者ID:ValdimarThor,項目名稱:Prism,代碼行數:22,代碼來源:UnityRegionNavigationContentLoaderFixture.cs

示例4: NavigateDelegatesToIRegionNavigationService

        public void NavigateDelegatesToIRegionNavigationService()
        {
            try
            {
                // Prepare
                IRegion region = new Region();

                object view = new object();
                region.Add(view);

                Uri uri = new Uri(view.GetType().Name, UriKind.Relative);
                Action<NavigationResult> navigationCallback = nr => { };
                NavigationParameters navigationParameters = new NavigationParameters();

                Mock<IRegionNavigationService> mockRegionNavigationService = new Mock<IRegionNavigationService>();
                mockRegionNavigationService.Setup(x => x.RequestNavigate(uri, navigationCallback, navigationParameters)).Verifiable();

                Mock<IServiceLocator> mockServiceLocator = new Mock<IServiceLocator>();
                mockServiceLocator.Setup(x => x.GetInstance<IRegionNavigationService>()).Returns(mockRegionNavigationService.Object);
                ServiceLocator.SetLocatorProvider(() => mockServiceLocator.Object);

                // Act
                region.RequestNavigate(uri, navigationCallback, navigationParameters);

                // Verify
                mockRegionNavigationService.VerifyAll();
            }
            finally
            {
                ServiceLocator.SetLocatorProvider(() => null);
            }
        }
開發者ID:noufionline,項目名稱:Prism,代碼行數:32,代碼來源:RegionFixture.cs


注:本文中的Prism.Regions.Region.RequestNavigate方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。