Files
hoodFieldOfView/头罩视野slove/头罩视野/Common/NavigationHelper.cs
2026-04-18 18:14:12 +08:00

30 lines
750 B
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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();
}
}
}