ProfilVM.cs 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Collections.ObjectModel;
  7. namespace WpfApp4.ViewModel
  8. {
  9. public class ProfilVM: BaseVM
  10. {
  11. private RelayCommand _ListTask;
  12. private ObservableCollection<User> _users;
  13. private User _user;
  14. private string _UserFIO;
  15. private string _login;
  16. private string _numberTel;
  17. public RelayCommand ListTask
  18. {
  19. get
  20. {
  21. return _ListTask ??
  22. (_ListTask = new RelayCommand((x) =>
  23. {
  24. TaskWindow taskWindow = new TaskWindow();
  25. taskWindow.Show();
  26. }));
  27. }
  28. }
  29. public string UserFIO
  30. {
  31. get => _UserFIO = User.AutoUser.Surname + " " + User.AutoUser.Name + " " + User.AutoUser.LastName;
  32. }
  33. public string UserLogin
  34. {
  35. get => _login = User.AutoUser.Login;//AutoUser - переменная, которая хранит значения авторизованного пользователя
  36. }
  37. public string UserPhone
  38. {
  39. get => _numberTel = User.AutoUser.NumberTel;
  40. }
  41. public ObservableCollection<User> Users
  42. {
  43. get => _users;
  44. set
  45. {
  46. _users = value;
  47. OnPropertyChanged();
  48. }
  49. }
  50. public User User
  51. {
  52. get => _user;
  53. set
  54. {
  55. _user = value;
  56. OnPropertyChanged();
  57. }
  58. }
  59. public ProfilVM ()
  60. {
  61. HelpContext helpContext = new HelpContext ();
  62. _users = new ObservableCollection<User>(helpContext.Users);
  63. _user = new User();
  64. }
  65. }
  66. }