1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Collections.ObjectModel;
- namespace Task1.ViewModel
- {
- class UserWindowVM : BaseViewModel
- {
- private ObservableCollection<User> _users;
- private User _user;
- private string _fio;
- private string _phone;
- private string _login;
- private RelayCommand _listTask;
- private RelayCommand _exit;
- public RelayCommand Exit
- {
- get
- {
- return _exit ??
- (_exit = new RelayCommand((x) =>
- {
- new MainWindow().Show();
- Helper.CloseWindowsAtType<UserWindow>();
- }));
- }
- }
- public RelayCommand ListTask
- {
- get
- {
- return _listTask??
- (_listTask = new RelayCommand((x) =>
- {
- new TaskWindow().Show();
- Helper.CloseWindowsAtType<UserWindow>();
- }));
- }
- }
- public ObservableCollection<User> Users
- {
- get => _users;
- set
- {
- _users = value;
- OnPropertyChanged();
- }
- }
- public User User
- {
- get => _user;
- set
- {
- _user = value;
- OnPropertyChanged();
- }
- }
-
- public string FIO
- {
- get => _fio = User.AUser.Surname + " " + User.AUser.Name + " " + User.AUser.Patronimyc;
- }
- public string Phone
- {
- get => _phone = User.AUser.Phone;
- }
- public string Login
- {
- get => _login = User.AUser.Login;
- }
- public UserWindowVM()
- {
- TaskContext taskContext = new TaskContext();
- _users = new ObservableCollection<User>(taskContext.Users);
- _user = new User();
- }
- }
- }
|