本文整理汇总了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;
}
示例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());
}
示例3: RaiseNavigated
private void RaiseNavigated(NavigationContext navigationContext)
{
if (this.Navigated != null)
{
this.Navigated(this, new RegionNavigationEventArgs(navigationContext));
}
}
示例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);
}
示例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);
}
示例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));
}
示例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);
}
示例8: OnNavigatedTo
public void OnNavigatedTo(NavigationContext navigationContext)
{
_player = (from player in _state.Context.Players
where
player.Id == (int) navigationContext.Parameters["player"]
select player).FirstOrDefault();
}
示例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);
}
示例10: ArgumentNullException
void INavigationAware.OnNavigatedTo(NavigationContext navigationContext)
{
if (navigationContext == null)
{
throw new ArgumentNullException("navigationContext");
}
Name = navigationContext.Parameters["Name"] as string;
}
示例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();
}
示例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());
}
}
示例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;
}
示例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);
}
}
示例15: IsNavigationTarget
public bool IsNavigationTarget(NavigationContext navigationContext)
{
var toCategoryTitle = ((CategoryVO) navigationContext.Parameters["To"]).Title;
if (Title == toCategoryTitle)
{
return true;
}
else
{
return false;
}
}