46 lines
1.3 KiB
C#
46 lines
1.3 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Input;
|
|
|
|
namespace WPF
|
|
{
|
|
public class MainWindowViewModel : ViewModelBase
|
|
{
|
|
public ICommand LoadHomePageCommand { get; private set; }
|
|
public ICommand LoadSettingsPageCommand { get; private set;}
|
|
|
|
private ViewModelBase _currentViewModel;
|
|
public ViewModelBase CurrentViewModel
|
|
{
|
|
get => _currentViewModel;
|
|
set
|
|
{
|
|
_currentViewModel = value;
|
|
OnPropertyChanged("CurrentViewModel");
|
|
}
|
|
}
|
|
|
|
public MainWindowViewModel()
|
|
{
|
|
this.LoadHomePage();
|
|
this.LoadHomePageCommand = new DelegateCommand(o => this.LoadHomePage());
|
|
this.LoadSettingsPageCommand = new DelegateCommand(o => this.LoadSettingsPage());
|
|
}
|
|
|
|
private void LoadHomePage()
|
|
{
|
|
CurrentViewModel = new HomePageViewModel(
|
|
new HomePage { PageTitle = "This is the Home Page" });
|
|
}
|
|
|
|
private void LoadSettingsPage()
|
|
{
|
|
CurrentViewModel = new SettingsPageViewModel(
|
|
new SettingsPage() { PageTitle = "This is the SettingsPage" });
|
|
}
|
|
}
|
|
}
|