using System.Windows.Input; using SparkClient.Views; namespace SparkClient.ViewModel.BaseWindow; public class MainViewModel: BaseViewModel { private static MainViewModel _instance; public static MainViewModel Instance => _instance ??= new MainViewModel(); private object _currentViewModel; public object CurrentViewModel { get => _currentViewModel; set { _currentViewModel = value; OnPropertyChanged(); } } public ICommand ShowHomeCommand { get; } public ICommand ShowHelperPageCommand { get; } public ICommand ShowSettingsPageCommand { get; } public ICommand ShowProfilePageCommand { get; } private MainViewModel() { // 初始化加载 HomeWindow CurrentViewModel = new HomeWindowVM(this); // 初始化命令 ShowHomeCommand = new RelayCommand(_ => CurrentViewModel = new HomeWindowVM(this)); ShowHelperPageCommand = new RelayCommand(_ => CurrentViewModel = new BaseControlVM(this, new HelperPage())); // ShowSettingsPageCommand = new RelayCommand(_ => CurrentViewModel = new BaseControlVM(this, new SettingsPage())); // ShowProfilePageCommand = new RelayCommand(_ => CurrentViewModel = new BaseControlVM(this, new ProfilePage())); } }