Files
MainSoftware/GuiWPF/MainWindowViewModel.cs
2021-05-05 13:49:59 +02:00

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 GuiWPF
{
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();
}
}
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" });
}
}
}