You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
1.3 KiB
42 lines
1.3 KiB
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())); |
|
} |
|
} |