本文整理汇总了C#中System.Windows.Navigation.NavigationService.GoForward方法的典型用法代码示例。如果您正苦于以下问题:C# NavigationService.GoForward方法的具体用法?C# NavigationService.GoForward怎么用?C# NavigationService.GoForward使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Navigation.NavigationService
的用法示例。
在下文中一共展示了NavigationService.GoForward方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ActivateNavigationService
public void ActivateNavigationService(NavigationService navigationService, bool deactivateAfterNavigation)
{
Action<PageSwitchedAggregatedEvent> callback = null;
callback = ae =>
{
try
{
this._logService.Trace(string.Format("About to navigate to: {0}. Use navigate service operation : {1}", ae.NavigationServiceOperation, ae.UseNavigationServiceOperation));
this._logService.Trace(string.Format("navigationService: {0}.", navigationService));
if (!ae.UseNavigationServiceOperation)
{
navigationService.Navigate(ae.Uri);
}
else
{
switch (ae.NavigationServiceOperation)
{
case PageSwitchedAggregatedEvent.NavigationServiceOperations.GoBack:
navigationService.GoBack();
break;
case PageSwitchedAggregatedEvent.NavigationServiceOperations.GoForward:
navigationService.GoForward();
break;
case PageSwitchedAggregatedEvent.NavigationServiceOperations.StopLoading:
navigationService.StopLoading();
break;
default:
throw new ArgumentOutOfRangeException();
}
}
this._logService.Trace(string.Format("Call to navigationServie issued. Deactivate after navigation : {0}", deactivateAfterNavigation));
if (deactivateAfterNavigation)
{
// callback will not be modified, therefore : no need to make a copy to avoid accessing a modified closure.
_eventAggregator.GetEvent<CompositePresentationEvent<PageSwitchedAggregatedEvent>>().Unsubscribe(callback);
}
}
catch (InvalidOperationException e)
{
_notificationService.Warning("Open syno is already navigating to a page. Please wait until the current navigation is over before switching to an other page.", "Just a second...");
}
};
_eventAggregator.GetEvent<CompositePresentationEvent<PageSwitchedAggregatedEvent>>().Subscribe(callback, true);
}