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


C# Regions.NavigationContext類代碼示例

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


NavigationContext類屬於Prism.Regions命名空間,在下文中一共展示了NavigationContext類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: RegionNavigationFailedEventArgs

        /// <summary>
        /// Initializes a new instance of the <see cref="RegionNavigationEventArgs"/> class.
        /// </summary>
        /// <param name="navigationContext">The navigation context.</param>
        public RegionNavigationFailedEventArgs(NavigationContext navigationContext)
        {
            if (navigationContext == null)
                throw new ArgumentNullException(nameof(navigationContext));

            this.NavigationContext = navigationContext;
        }
開發者ID:Citringo,項目名稱:Prism,代碼行數:11,代碼來源:RegionNavigationFailedEventArgs.cs

示例2: OnNavigatedTo

        /// <summary>
        ///     Called when the implementer has been navigated to.
        /// </summary>
        /// <param name="navigationContext">The navigation context.</param>
        public override void OnNavigatedTo(NavigationContext navigationContext)
        {
            base.OnNavigatedTo(navigationContext);

            Invoices.Clear();
            Invoices.AddRange(ConManager.GetAllInvoices());
        }
開發者ID:George-Andras,項目名稱:HomeInventories,代碼行數:11,代碼來源:InvoicesViewModel.cs

示例3: RaiseNavigated

 private void RaiseNavigated(NavigationContext navigationContext)
 {
     if (this.Navigated != null)
     {
         this.Navigated(this, new RegionNavigationEventArgs(navigationContext));
     }
 }
開發者ID:Citringo,項目名稱:Prism,代碼行數:7,代碼來源:RegionNavigationService.cs

示例4: WhenRegionHasMultipleViews_ThenViewsWithMatchingFullTypeNameAreConsidered

        public void WhenRegionHasMultipleViews_ThenViewsWithMatchingFullTypeNameAreConsidered()
        {
            // Arrange

            var serviceLocatorMock = new Mock<IServiceLocator>();

            var region = new Region();

            var view1 = new TestView();
            var view2 = "view";

            region.Add(view1);
            region.Add(view2);

            var navigationContext = new NavigationContext(null, new Uri(view2.GetType().FullName, UriKind.Relative));

            var navigationTargetHandler = new TestRegionNavigationContentLoader(serviceLocatorMock.Object);

            // Act

            var returnedView = navigationTargetHandler.LoadContent(region, navigationContext);

            // Assert

            Assert.AreSame(view2, returnedView);
        }
開發者ID:ValdimarThor,項目名稱:Prism,代碼行數:26,代碼來源:LocatorNavigationTargetHandlerFixture.cs

示例5: WhenAskedCanNavigateForDifferentQuery_ThenReturnsFalse

        public void WhenAskedCanNavigateForDifferentQuery_ThenReturnsFalse()
        {
            var email = new EmailDocument();

            var emailServiceMock = new Mock<IEmailService>();
            emailServiceMock
                .Setup(svc => svc.GetEmailDocument(email.Id))
               .Returns(email)
               .Verifiable();

            var viewModel = new EmailViewModel(emailServiceMock.Object);

            NavigationContext context = new NavigationContext(new Mock<IRegionNavigationService>().Object, new Uri("location", UriKind.Relative));
            context.Parameters.Add("EmailId", email.Id);
            
            ((INavigationAware)viewModel).OnNavigatedTo(context);

            context = new NavigationContext(new Mock<IRegionNavigationService>().Object, new Uri("location", UriKind.Relative));
            context.Parameters.Add("EmailId", new Guid());

            bool canNavigate =
                ((INavigationAware)viewModel).IsNavigationTarget(context);

            Assert.IsFalse(canNavigate);
        }
開發者ID:transformersprimeabcxyz,項目名稱:Prism-Samples-Wpf,代碼行數:25,代碼來源:EmailViewModelFixture.cs

示例6: WhenNoCurrentMatchingViewExists_ThenReturnsNewlyCreatedInstanceWithServiceLocatorAddedToTheRegion

        public void WhenNoCurrentMatchingViewExists_ThenReturnsNewlyCreatedInstanceWithServiceLocatorAddedToTheRegion()
        {
            // Arrange

            var serviceLocatorMock = new Mock<IServiceLocator>();

            var region = new Region();

            var view = new TestView();

            serviceLocatorMock
                .Setup(sl => sl.GetInstance<object>(view.GetType().Name))
                .Returns(view);

            var navigationContext = new NavigationContext(null, new Uri(view.GetType().Name, UriKind.Relative));

            var navigationTargetHandler = new TestRegionNavigationContentLoader(serviceLocatorMock.Object);

            // Act

            var returnedView = navigationTargetHandler.LoadContent(region, navigationContext);

            // Assert

            Assert.AreSame(view, returnedView);
            Assert.IsTrue(region.Views.Contains(view));
        }
開發者ID:ValdimarThor,項目名稱:Prism,代碼行數:27,代碼來源:LocatorNavigationTargetHandlerFixture.cs

示例7: WhenViewExistsAndDoesNotImplementINavigationAware_ThenReturnsView

        public void WhenViewExistsAndDoesNotImplementINavigationAware_ThenReturnsView()
        {
            // Arrange

            var serviceLocatorMock = new Mock<IServiceLocator>();

            var region = new Region();

            var view = new TestView();

            region.Add(view);

            var navigationContext = new NavigationContext(null, new Uri(view.GetType().Name, UriKind.Relative));

            var navigationTargetHandler = new TestRegionNavigationContentLoader(serviceLocatorMock.Object);


            // Act

            var returnedView = navigationTargetHandler.LoadContent(region, navigationContext);


            // Assert

            Assert.AreSame(view, returnedView);
        }
開發者ID:Citringo,項目名稱:Prism,代碼行數:26,代碼來源:LocatorNavigationTargetHandlerFixture.cs

示例8: OnNavigatedTo

 public void OnNavigatedTo(NavigationContext navigationContext)
 {
     _player = (from player in _state.Context.Players
         where
             player.Id == (int) navigationContext.Parameters["player"]
         select player).FirstOrDefault();
 }
開發者ID:TheAirlineProject,項目名稱:tap-desktop,代碼行數:7,代碼來源:PageAirlineDataViewModel.cs

示例9: OnNavigatedFrom

 public void OnNavigatedFrom(NavigationContext navigationContext)
 {
     IRFIDService rfidService = container.Resolve<IRFIDService>();
     rfidService.stop();
     eventAggregator.GetEvent<RFIDNewItemEvent>().Unsubscribe(handleNewItemFromRFID);
     eventAggregator.GetEvent<RFIDHardwareEvent>().Unsubscribe(handleErrorFromRFID);
     eventAggregator.GetEvent<DatabaseEvent>().Unsubscribe(handleErrorFromDatabase);
 }
開發者ID:heyuantao,項目名稱:BookLocationProject,代碼行數:8,代碼來源:BookLocationShowViewModel.cs

示例10: ArgumentNullException

 void INavigationAware.OnNavigatedTo(NavigationContext navigationContext)
 {
     if (navigationContext == null)
     {
         throw new ArgumentNullException("navigationContext");
     }
     Name = navigationContext.Parameters["Name"] as string;
 }
開發者ID:countincognito,項目名稱:Zametek.PrismEx.AvalonDock,代碼行數:8,代碼來源:DocumentViewModel.cs

示例11: OnNavigatedTo

        public void OnNavigatedTo(NavigationContext navigationContext)
        {
            //Start running a script
            string filename = (string)navigationContext.Parameters["filename"];

            _script = new TaiScript(filename,TAIClient.taiClient);
            _script.Start();
        }
開發者ID:t0b1z,項目名稱:A-CAT,代碼行數:8,代碼來源:ScriptRunningViewModel.cs

示例12: OnNavigatedTo

        /// <summary>
        ///     Called when the implementer has been navigated to.
        /// </summary>
        /// <param name="navigationContext">The navigation context.</param>
        public override void OnNavigatedTo(NavigationContext navigationContext)
        {
            base.OnNavigatedTo(navigationContext);

            {
                Clients.AddRange(ConManager.GetAllClients());
            }
        }
開發者ID:George-Andras,項目名稱:HomeInventories,代碼行數:12,代碼來源:ClientsViewModel.cs

示例13: RegionNavigationEventArgs

        /// <summary>
        /// Initializes a new instance of the <see cref="RegionNavigationEventArgs"/> class.
        /// </summary>
        /// <param name="navigationContext">The navigation context.</param>
        public RegionNavigationEventArgs(NavigationContext navigationContext)
        {
            if (navigationContext == null)
            {
                throw new ArgumentNullException("navigationContext");
            }

            this.NavigationContext = navigationContext;
        }
開發者ID:ValdimarThor,項目名稱:Prism,代碼行數:13,代碼來源:RegionNavigationEventArgs.cs

示例14: OnNavigatedTo

        public void OnNavigatedTo(NavigationContext navigationContext)
        {
            if (PlugInNames.Count != 0)
                return;

            foreach(ModuleInfo mi in _moduleCatalog.Modules)
            {
                if(mi.ModuleName != "PlugInHomeModule" && mi.ModuleName != "StartScreenModule")
                    PlugInNames.Add(mi.ModuleName);
            }
        }
開發者ID:t0b1z,項目名稱:FrameworkTest,代碼行數:11,代碼來源:PlugInHomeViewModel.cs

示例15: IsNavigationTarget

 public bool IsNavigationTarget(NavigationContext navigationContext)
 {
     var toCategoryTitle = ((CategoryVO) navigationContext.Parameters["To"]).Title;
     if (Title == toCategoryTitle)
     {
         return true;
     }
     else
     {
         return false;
     }
 }
開發者ID:ProductiveEngine,項目名稱:KnowledgeBase,代碼行數:12,代碼來源:CategoryInfoViewModel.cs


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