上传代码
This commit is contained in:
30
头罩视野slove/头罩视野/Common/NavigationHelper.cs
Normal file
30
头罩视野slove/头罩视野/Common/NavigationHelper.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Controls;
|
||||
|
||||
public static class NavigationHelper
|
||||
{
|
||||
public static Frame MainFrame { get; set; }
|
||||
private static Stack<Page> _history = new Stack<Page>();
|
||||
|
||||
// 跳转页面
|
||||
public static void NavigateTo(Page page)
|
||||
{
|
||||
if (MainFrame.Content != null)
|
||||
_history.Push( MainFrame.Content as Page);
|
||||
|
||||
MainFrame.Content = page;
|
||||
}
|
||||
|
||||
// 返回上一页
|
||||
public static void GoBack()
|
||||
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine("页面加载了!55555");
|
||||
if (_history.Count > 0)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine("页面加载了!4444");
|
||||
MainFrame.Content = _history.Pop();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user