123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using WpfApp29.Pages;
- namespace WpfApp29.ViewModels
- {
- internal class UserWindowViewModel
- {
- public UserWindowViewModel()
- {
- AppHelper.GetWindowAtType<UserWindow>()?.FramePages.Navigate(MainPage);
- }
- private MainPage? _mainPage;
- private AccountPage? _accountPage;
- private UserListPage? _userListPage;
- public MainPage MainPage
- {
- get => _mainPage ??= new MainPage();
- }
- public AccountPage AccountPage
- {
- get => _accountPage ??= new AccountPage();
- }
- public UserListPage UserListPage
- {
- get => _userListPage ??= new UserListPage();
- }
- public RelayCommand? _commandGoMainMenu;
- public RelayCommand CommandGoMainMenu
- {
- get
- {
- return _commandGoMainMenu ??= new RelayCommand(
- x =>
- {
- AppHelper.GetWindowAtType<UserWindow>()?.FramePages.Navigate(MainPage);
- },
- x =>
- {
- if (AppHelper.GetWindowAtType<UserWindow>()?.FramePages.Content is MainPage)
- {
- return false;
- }
- return true;
- }
- );
- }
- }
- public RelayCommand? _commandGoAccount;
- public RelayCommand CommandGoAccount
- {
- get
- {
- return _commandGoAccount ??= new RelayCommand(
- x =>
- {
- AppHelper.GetWindowAtType<UserWindow>()?.FramePages.Navigate(AccountPage);
- },
- x =>
- {
- if (AppHelper.GetWindowAtType<UserWindow>()?.FramePages.Content is AccountPage)
- {
- return false;
- }
- return true;
- }
- );
- }
- }
- public RelayCommand? _commandGoUserList;
- public RelayCommand CommandGoUserList
- {
- get
- {
- return _commandGoUserList ??= new RelayCommand(
- x =>
- {
- AppHelper.GetWindowAtType<UserWindow>()?.FramePages.Navigate(UserListPage);
- },
- x =>
- {
- if (AppHelper.GetWindowAtType<UserWindow>()?.FramePages.Content is UserListPage)
- {
- return false;
- }
- return true;
- }
- );
- }
- }
- public RelayCommand? _commandGoExit;
- public RelayCommand CommandGoExit
- {
- get
- {
- return _commandGoExit ??= new RelayCommand(
- x =>
- {
- new MainWindow().Show();
- AppHelper.GetWindowAtType<UserWindow>()?.Close();
- }
- );
- }
- }
- }
- }
|