实现了导航功能

This commit is contained in:
2025-06-10 20:55:39 +08:00
parent 1294adfbfd
commit b118e8ec90
20 changed files with 329 additions and 122 deletions

View File

@@ -0,0 +1,29 @@
using System.ComponentModel;
using System.Windows;
using Microsoft.Extensions.DependencyInjection;
using PMSWPF.ViewModels;
namespace PMSWPF.Services;
public class NavgatorServices
{
private ViewModelBase currentViewModel;
public ViewModelBase CurrentViewModel
{
get { return currentViewModel; }
set
{
currentViewModel = value;
OnViewModelChanged?.Invoke();
}
}
public event Action OnViewModelChanged ;
public void NavigateTo<T>() where T : ViewModelBase
{
// Application.Current
CurrentViewModel = App.Current.Services.GetService<T>();
}
}