本文整理汇总了C#中System.Windows.Navigation.NavigationService类的典型用法代码示例。如果您正苦于以下问题:C# NavigationService类的具体用法?C# NavigationService怎么用?C# NavigationService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NavigationService类属于System.Windows.Navigation命名空间,在下文中一共展示了NavigationService类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: StudentManagement
public StudentManagement(int userId, NavigationService navigationService)
{
//User Id and navigation service stored
_userId = userId;
_navigationService = navigationService;
//Page Initialized
InitializeComponent();
//Students returned from database
var studentList = _client.ReturnStudents();
//Check to ensure students exist
if (studentList != null)
{
//Population of students list
foreach (var s in studentList)
{
_studentCollectionList.Add(s);
}
}
StudentList.ItemsSource = _studentCollectionList;
//Default page information set
Title.Text = "No selection made.";
Forename.Text = "None";
Surname.Text = "None";
Email.Text = "None";
Course.Text = "None";
Year.Text = "None";
}
示例2: AddPageToHistory
public void AddPageToHistory(NavigationService nav)
{
int count = GetBackStackCount(nav);
if (count > PageHistoryStack.Count + 1)
{
return;
}
if (count < PageHistoryStack.Count)
{
PageHistoryStack.RemoveAt(PageHistoryStack.Count - 1);
LastPageName = null;
}
if (count > PageHistoryStack.Count)
{
PageHistoryStack.Add(
new PageEntry()
{
PageUrl = nav.CurrentSource.OriginalString
}
);
LastPageName = null;
}
}
示例3: CreateButton
internal static ApplicationBarIconButton CreateButton(string text, string iconPath, NavigationService navigationService, string navigateTo)
{
ApplicationBarIconButton button = new ApplicationBarIconButton(new Uri(iconPath, UriKind.Relative));
button.Text = text;
button.Click += (sender, e) => { navigationService.Navigate(new Uri(navigateTo, UriKind.Relative)); };
return button;
}
示例4: Replay
public override void Replay(NavigationService navigationService, NavigationMode mode)
{
ContentControl navigator = (ContentControl)navigationService.INavigatorHost;
// Find a reference to the DocumentViewer hosted in the NavigationWindow
// On initial history navigation in the browser, the window's layout may not have been
// done yet. ApplyTemplate() causes the viewer to be created.
navigator.ApplyTemplate();
DocumentApplicationDocumentViewer docViewer = navigator.Template.FindName(
"PUIDocumentApplicationDocumentViewer", navigator)
as DocumentApplicationDocumentViewer;
Debug.Assert(docViewer != null, "PUIDocumentApplicationDocumentViewer not found.");
if (docViewer != null)
{
// Set the new state on the DocumentViewer
if (_state is DocumentApplicationState)
{
docViewer.StoredDocumentApplicationState = (DocumentApplicationState)_state;
}
// Check that a Document exists.
if (navigationService.Content != null)
{
IDocumentPaginatorSource document = navigationService.Content as IDocumentPaginatorSource;
// If the document has already been paginated (could happen in the
// case of a fragment navigation), then set the DocumentViewer to the
// new state that was set.
if ((document != null) && (document.DocumentPaginator.IsPageCountValid))
{
docViewer.SetUIToStoredState();
}
}
}
}
示例5: ClearBackStack
public static void ClearBackStack(NavigationService service)
{
while (service.BackStack.Any())
{
service.RemoveBackEntry();
}
}
示例6: Navigate
public void Navigate(Frame frame, FrameworkElement nextElement)
{
navigationService = frame.NavigationService;
if (navigationService == null) { return; }
srcElement = navigationService.Content as FrameworkElement;
targetElement = nextElement;
if (srcElement != null)
{
navigationService.Navigating += NavigationAnimator_Navigating;
}
if (transition == null)
{
var mask1 = new Rectangle()
{
Fill = new SolidColorBrush(Color.FromArgb(77, 8, 17, 48))
};
var mask2 = new Rectangle()
{
Fill = new SolidColorBrush(Color.FromArgb(77, 8, 17, 48))
};
transition = new ExampleTransition(mask1, mask2);
}
navigationService.Navigate(nextElement);
}
示例7: ReplyCommand
public ReplyCommand(string threadId, string subject, NavigationService service)
{
_threadId = threadId;
_subject = subject;
_navigationService = service;
CanExecuteIt = true;
}
示例8: StaffManagement
public StaffManagement(int userId, NavigationService navigationService)
{
//initialization of maintained data
_userId = userId;
_navigationService = navigationService;
//Page rendered
InitializeComponent();
//Staff List returned from web service and added to listed display
var staffList = _client.ReturnStaff();
if (staffList != null)
{
foreach (var s in staffList)
{
_staffCollectionList.Add(s);
}
}
//Binding of observable collection to page list
StaffList.ItemsSource = _staffCollectionList;
//Setting default display items
Title.Text = "No selection made.";
Forename.Text = "None";
Surname.Text = "None";
Email.Text = "None";
Course.Text = "None";
}
示例9: CreateNewModule
//Window initailaized
public CreateNewModule(int userId, NavigationService navigation)
{
//user Id and navigatino service maintained
_userId = userId;
_navigation = navigation;
//Window opened
InitializeComponent();
}
示例10: CreateNewCourse
//Window initailized
public CreateNewCourse(int userId, NavigationService navigationService)
{
//user Id and navigatino service maintained
_navigation = navigationService;
_userId = userId;
//Window initailized
InitializeComponent();
}
示例11: Button1Click
private void Button1Click(object sender, RoutedEventArgs e)
{
if (_beginHost) return;
e.Handled = true;
_beginHost = true;
_ns = NavigationService;
Program.LClient.BeginHostGame(_game, textBox1.Text);
}
示例12: FrameNavigationServiceWrapper
/// <summary>
/// Initializes a new instance of the <see cref="FrameNavigationServiceWrapper"/> class.
/// </summary>
/// <param name="dispatcher">The dispatcher.</param>
/// <param name="frame">The frame.</param>
public FrameNavigationServiceWrapper(Dispatcher dispatcher, Frame frame)
{
this.dispatcher = dispatcher;
this.frame = frame;
navigationService = this.frame.NavigationService;
navigationService.Navigating += NavigationServiceNavigating;
navigationService.Navigated += NavigationServiceNavigated;
}
示例13: PageOptionsOnLoaded
private void PageOptionsOnLoaded(object sender, RoutedEventArgs e)
{
navigation = NavigationService.GetNavigationService(this);
ComboBox_NumberOfThrowings.SelectedIndex = preferences.NumberOfThrowings - 1;
TextBox_HeadBonus.Text = preferences.HeadBonus.ToString();
TextBox_TailCost.Text = preferences.TailCost.ToString();
TextBox_DoubleHeadBonus.Text = preferences.DoubleHeadBonus.ToString();
}
示例14: CreateNewBuilding
//window initialized
public CreateNewBuilding(int userId, NavigationService navigationService)
{
//user Id and navigatino service maintained
_navigation = navigationService;
_userId = userId;
//window created
InitializeComponent();
}
示例15: NavigationTransitionSelector
/// <summary>
/// Initializes a new instance of the <see cref="NavigationTransitionSelector"/> class.
/// </summary>
/// <param name="navigationService">The navigation service.</param>
/// <param name="transitionRegistry">The transition registry.</param>
public NavigationTransitionSelector(NavigationService navigationService, NavigationTransitionRegistry transitionRegistry)
{
BackStack = new Stack<NavigationTransition>();
ForwardStack = new Stack<NavigationTransition>();
this.transitionRegistry = transitionRegistry;
this.navigationService = navigationService;
this.navigationService.Navigating += HandleContentNavigating;
this.navigationService.Navigated += HandleContentNavigated;
}