Files
hoodFieldOfView/头罩视野slove/头罩视野/Common/NavigationHelper.cs

30 lines
750 B
C#
Raw Normal View History

2026-04-18 18:14:12 +08:00
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();
}
}
}