using XFEExtension.NetCore.WinUIHelper.Implements.Services;
using XFEExtension.NetCore.WinUIHelper.Interface.Services;
using XFEExtension.NetCore.WinUIHelper.Utilities.Additions;
namespace XFEExtension.NetCore.WinUIHelper.Utilities.Helper;
///
/// 导航帮助类
///
public static class NavigationHelper
{
///
/// 设置目标页面的导航参数
///
/// 目标页面
/// 导航参数
public static void SetParameter(this Page page, object? parameter) => page.GetType().GetProperty("Parameter")?.SetValue(page, parameter);
///
/// 获取导航参数
///
/// 目标页面
/// 导航参数
public static object? GetParameter(this Page page)
{
var viewModelProperty = page.GetType().GetProperty("ViewModel");
var parameterProperty = viewModelProperty?.PropertyType.GetProperties().FirstOrDefault(property => property.PropertyType.Name == typeof(IAutoNavigationParameterService